Deploy Applications to Azure Kubernetes Service (AKS) With Kubectl

In this blog post, I will show you how to deploy applications to Azure Kubernetes Service (AKS) using kubectl without a YAML file.

Kubectl

If you have an AKS cluster you can deploy an application to your cluster using the Kubectl command-line utility and you don’t have to use a YAML or a JSON file for deployment. Using a deployment file like YAML can help keep a record of deployments and also use version control to track changes.

Sometimes you might have cases where you would like to run quick deployments without using a YAML file, and this is where kubectl can help.

Deployment

Below I have a deployment that deploys an application from a Docker image. The image can be located in ACR or a public repository.

kubectl create deployment MyApp --image=imagepath

Expose Application

To expose the application to the internet, I will run the following command which will use the AKS load balancer public IP address and will use port 80. Make sure you use the application name that was used for the deployment.

kubectl create service loadbalancer MyApp --tcp=80

To connect an AKS cluster to ACR registry please check this blog post.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.