skip to Main Content

To deploy an application to AKS I have to:

  1. Deploy my application to Azure Container Registry
  2. Create Azure Kubernetes Service
  3. Create files: service.yml and deployment.yml
  4. Connect to AKS using commands:

enter image description here

  1. Execute commands in the command line:
kubectl apply -f deployment.yml
kubectl apply -f service.yml

Is it possible to skip connecting to AKS and executing commands above to simplify the deployment process somehow?

2

Answers


  1. The az aks get-credentials command lets you get the access credentials for an AKS cluster and merges these credentials into the kubeconfig file, which can be used to configure access to a cluster without using commands such as az login or az aks get-credentials.

    Instead of generating the file every single time you can save the generated/updated kubeconfig file into your local machine or for example an Azure Keyvault secret, in case you’re running a pipeline.

    Please note that the kubeconfig file supports multiple clusters, users, and authentication mechanisms. More details about it can be found in Configure Access to Multiple Clusters and in configure access to a cluster. See also Kubeconfig File Explained With Practical Examples.

    Login or Signup to reply.
  2. You can use bicep kuberentes provider, which convert your aks resource to bicep resources, and you can deploy the aks workload much like az deployment, you do not need to involve the kubectl command, it is helpful in automatically scenario.

    Here is the sample, you need vscode + bicep extension

    https://learn.microsoft.com/en-us/azure/aks/learn/quick-kubernetes-deploy-bicep-extensibility-kubernetes-provider?tabs=azure-cli

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search