Search code examples
azureazure-aksazure-cloud-shellazure-yaml-pipelines

How to run yaml file from Azure cloud shell


I have created a Windows Server container on an Azure Kubernetes Service (AKS) cluster using the Azure CLI. While trying to deploy my aspnet core app to the AKS cluster, I am stuck on this step of the above link. I have sample.yaml file on my Windows-10 hard drive that needs to run in the Azure cloud shell using the following command:

kubectl apply -f sample.yaml

Question: Where can I place the above sample.yaml file so I can run the above command in Azure Cloud Shell? I am assuming it probably has to be somewhere in my Azure storage account but where exactly it should be placed so above command can recognize its path? Currently it's giving an expected error: the path "sample.yaml" does not exist


Solution

  • You can directly create a file named sample.yaml using vi or nano or code sample.yaml in the Azure could shell then copy your YAML definition.

    For example, type code sample.yaml in the Azure Bash. It opens a sample.yaml file then copy YMAL content and save it. The file automatically was stored in your current working path /home/user.

    enter image description here

    Or, you can upload your sample.yaml from your local to the Azure path.

    Or, you also could persistently store your file into the Azure file share. To find the Azure file share, you can type df command.

    enter image description here