Deploy Kubernetes app to AKS

 

Microsoft Azure Kubernetes Service, part 2 Kubernetes App on AKS-deploy

In the second part of this series, we want to deploy an application on an AKS cluster that consists of several containers. Thanks to the integrated kubectl command line and other functions, the Azure Kubernetes service succeeds without great circumstances.

Companies on the topic

Deploying the app on the AKS cluster.Deploying the app on the AKS cluster.

(Picture: Drilling)

In the first part of this workshop, we provided the Kubernetes control level-that is, the Kubernetes master components – as a cluster completely managed by Azure. Now we want to deploy an application on our Cluster. It is a voting app from the Azure samples at GitHub, whose sample code Microsoft makes available for testing.

As we know, a manifest file for Kubernetes declaratively defines a” desired state ” for the cluster. Among other things, the file indicates which container images (e.g. from the Docker Hub) should be executed on the cluster. The manifest file from the GitHub example creates all the objects needed to deploy the voting app.

The manifest defines two Kubernetes deployments, one for the Python sample app for voting and another for a Redis instance. Furthermore, the manifest creates two Kubernetes services, namely an internal service (cluster IP) for the Redis instance and an external service for a load balancer, through which end users access the voting app from the Internet.

As a reminder, the Cluster IP service (outstaffing) creates an internal IP address that is only used within the AKS cluster, e.g. for internal applications that support other workloads in the cluster.

Cluster IP is a Kubernetes Virtual Network service that provides connectivity for internal application.Cluster IP is a Kubernetes Virtual Network service that provides connectivity for internal application.

(Image: Microsoft)

The Load Balancer service creates an Azure Load Balancer resource, configures its frontend configuration with an external IP address, and connects the pods requested to the backend pool. Load balancing rules are created at the desired ports in such a way that the user’s data traffic reaches the application.

LoadBalancer is a Kubernetes virtual network service that provides connectivity for external application. With AKS, this Kubernetes service is mapped to an Azure Load Balancer.LoadBalancer is a Kubernetes virtual network service that provides connectivity for external application. With AKS, this Kubernetes service is mapped to an Azure Load Balancer.

(Image: Microsoft)

However, this workshop is not about the application itself or the manifest file in detail, we are rather interested in the tool sets to be used for the provision. As mentioned above, the manifest file for the complete application is available on GitHub in various forms: “Azure Vote All-in-One”, “Services” (for the aforementioned cluster IP and the load balancer), “Storage resources”, “Pod Secrets” and “azure vote deployment”. In this workshop, we will confine ourselves to the latter, i.e. the pure deployment of the voting app frontend.

Kubectl

Unlike EKS in AWS (Elastic Kubernetes Service), Azure does not require you to deploy the kubectl command-line tool or set up cluster authentication to the extent described in our EKS workshops. At least not if you use the Azure cloud shell as a client: kubectl is already installed here.

The Azure Vote manifest file with the associated deployment in the CloudShell.The Azure Vote manifest file with the associated deployment in the CloudShell.

(Image: Drilling / Microsoft)

So you simply start a cloud shell from the Azure portal and use any editor, such as nano in the cloud shell bash, into which we paste the content of the manifest file copied from the clipboard from the GitHub page mentioned above. Then you leave nano with [Strg X] and saves the content of the new files and an appropriate name such as ” azure-vote.yaml“. The extension is important because it is a Yaml file.

Now we connect to the cluster, download the credentials, and configure the Kubernetes CLI to use them. This happens on the Azure CLI (this can be used in the Azure cloud shell at both the bash and the powershell):

az aks get-credentials --resource-group <RessourceGroup-Name> --name <Cluster Name>

Review the successful deployment of the cluster.Review the successful deployment of the cluster.

(Picture: Drilling)

To check the connection to the AKS cluster you can use the command …

kubectl get nodes

… use. The command returns all node pools with the nodes in them. In the example, this is just the so-called primary node pool called “aks-agentpool”, which currently consists of exactly one node.

Deploying the app on the AKS cluster.Deploying the app on the AKS cluster.

(Picture: Drilling)

Now we can deploy our voting app on the cluster as follows:

kubectl apply -f azure-vote.yaml

When the application is running, a Kubernetes service provides the front-end of the application to the Internet. The process may take a few minutes. You can monitor the progress in the Cloud Shell with the kubelet-command “get-service” :

kubectl get service azure-vote-front --watch

Successful deployment of the voting app on an AKS cluster.Successful deployment of the voting app on an AKS cluster.

(Image: Drilling / Microsoft)

Now you just have to wait until the EXTERNAL IP address changes from “pending” to an actual public IP address. Then you can break out the command with Ctrl + C and use the external IP in a browser window to check if the frontend app is available, as seen in the preceding image.

(ID:46968121)

Ready to see us in action:

More To Explore

IWanta.tech
Logo
Enable registration in settings - general
Have any project in mind?

Contact us:

small_c_popup.png