In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to deploy Kubernetes container cluster in Azure". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to deploy Kubernetes container cluster in Azure".
In this quick start tutorial, we use Azure CLI to create a Kubernetes cluster, and then deploy and run a multi-container application consisting of a Web front end and a Redis instance on the cluster. Once the deployment is complete, the application can be accessed over the Internet.
Sample application screenshot
This quick start tutorial assumes that you have a basic understanding of the concept of Kubernetes. For more information about Kubernetes, please refer to the Kubernetes documentation.
If you do not have an Azure account, please create a free account before you start.
Log in to the Azure Cloud console
The Azure Cloud console is a free Bash shell that you can run directly on the Azure website. It is pre-configured in your account. Click the "Cloud Shell" button on the menu in the upper right corner of the Azure portal.
Cloud Shell
This button launches an interactive shell that you can use to run all the steps in this tutorial.
Cloud Shell screenshot
The version of Azure CLI used in this getting started tutorial is required to be 2.0.4. If you choose to install and use the CLI tool locally, run az-- version to check the installed version. If you need to install or upgrade, see installing Azure CLI 2.0.
Create a resource group
Use the az group create command to create a resource group, and an Azure resource group is a logical group that refers to the deployment and management of Azure resources.
The following example creates a resource group named myResourceGroup in the eastus area.
Az group create-name myResourceGroup-location eastus
Output:
{"id": "/ subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup", "location": "eastus", "managedBy": null, "name": "myResourceGroup", "properties": {"provisioningState": "Succeeded"}, "tags": null}
Create a Kubernetes cluster
Use the az acs create command to create a Kubernetes cluster in the Azure container service. The following example creates a cluster named myK8sCluster using a Linux master node and three Linux proxy nodes.
Az acs create-orchestrator-type=kubernetes-resource-group myResourceGroup-name=myK8sCluster-generate-ssh-keys
After a few minutes, the command will complete and return information about the json format of the cluster.
Connect to a Kubernetes cluster
To manage Kubernetes clusters, you can use the Kubernetes command line tool kubectl.
If you are using Azure CloudShell, kubectl is already installed. If you want to install locally, you can use the az acs kubernetes install-cli command.
To configure kubectl to connect to your Kubernetes cluster, run the az acs kubernetes get-credentials command to download the credentials and configure Kubernetes CLI to use them.
Az acs kubernetes get-credentials-resource-group=myResourceGroup-name=myK8sCluster
To verify the connection to the cluster, use the kubectl get command to view the list of cluster nodes.
Kubectl get nodes
Output:
NAME STATUS AGE VERSION k8s-agent-14ad53a1-0 Ready 10mv1.6.6 k8s-agent-14ad53a1-1 Ready 10mv1.6.6 k8s-agent-14ad53a1-2 Ready 10mv1.6.6 k8s-master-14ad53a1-0 Ready,SchedulingDisabled 10mv1.6.6
Run the application
The Kubernetes manifest file defines a required state for the cluster, including what kind of container images should run in the cluster. For this example, the manifest is used to create all the objects needed to run the Azure Vote application.
Create a file called azure-vote.yaml and copy the following into YAML.
ApiVersion: apps/v1beta1 kind: Deployment metadata: name: azure-vote-back spec: replicas: 1 template: metadata: labels: app: azure-vote-back spec: containers:-name: azure-vote-back image: redis ports:-containerPort: 6379 name: redis-- apiVersion: v1 kind: Service metadata: name: azure-vote-back spec: Ports:-port: 6379 selector: app: azure-vote-back-- apiVersion: apps/v1beta1 kind: Deployment metadata: name: azure-vote-front spec: replicas: 1 template: metadata: labels: app: azure-vote-front spec: containers:-name: azure-vote-front image: microsoft/azure-vote-front:redis-v1 ports:- ContainerPort: 80 env:-name: REDIS value: "azure-vote-back"-apiVersion: v1 kind: Service metadata: name: azure-vote-front spec: type: LoadBalancer ports:-port: 80 selector: app: azure-vote-front
Use the kubectl create command to run the application.
Kubectl create-f azure-vote.yaml
Output:
Deployment "azure-vote-back" created service "azure-vote-back" created deployment "azure-vote-front" created service "azure-vote-front" created
Test the application
When the application is up and running, you need to create a Kubernetes service to expose the front end of the application to the Internet. This process may take several minutes to complete.
To monitor this process, use the kubectl get service command with the-- watch parameter.
Kubectl get service azure-vote-front-watch
Initially, the EXTERNAL-IP of the azure-vote-front service appears as pending. Once the EXTERNAL-IP address has changed from pending to a specific IP address, use "CTRL-C" to stop the kubectl monitoring process.
Azure-vote-front 10.0.34.242 80:30676/TCP 7s azure-vote-front 10.0.34.242 52.179.23.131 80:30676/TCP 2m
Now you can access the Azure Vote application through this extranet IP address.
Browse screenshots of Azure Vote App
Delete a cluster
When clustering is no longer needed, you can use the az group delete command to delete resource groups, container services, and all related resources.
Az group delete-name myResourceGroup-yes-no-wait Thank you for your reading. The above is the content of "how to deploy Kubernetes container cluster in Azure". After the study of this article, I believe you have a deeper understanding of how to deploy Kubernetes container cluster in Azure, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.