Last active
October 28, 2021 09:47
-
-
Save DheerajP/0c0ea6aea2d9cfa417356379f222c4ae to your computer and use it in GitHub Desktop.
Useful commands while working with AKS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Switch between subscriptions | |
az account set --subscription "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" | |
#Set the context of your current AKS | |
az aks get-credentials -a --resource-group resourceGroupName --name aksName --overwrite-existing | |
#Set the context of your current Namespace in AKS | |
kubectl config set-context --current --namespace=nameofYourNameSpace | |
#Kill a pod | |
Kubectl delete pods NameOfThePod | |
#interactive RDP session | |
kubectl exec -it nameOftheContainer -- powershell | |
#give me environmental variables when you are inside the container | |
gci env:* | sort-object name | |
#Delete a pod | |
kubectl scale deployment nameOfTheDeployment --replicas=0 -n nameSpaceOfTheDeployment | |
#Restart a pod | |
kubectl scale deployment nameOfTheDeployment --replicas=1 -n nameSpaceOfTheDeployment | |
#copy files form local to AKS | |
kubectl cp /temp/localpath/filename.txt namespaceOftheAKS/NameofTheContainer:/inetpub/wwwroot/App_config/Connectionstrings.config | |
#copy files form AKS to local | |
kubectl cp namespaceOftheAKS/NameofTheContainer:/inetpub/wwwroot/App_config/Connectionstrings.config /temp/localpath/test.config | |
#Connect to AKS cluster | |
az aks get-credentials -g NAMEOFTHERESOURCEGROUP -n NAMEOFTHECLUSTER | |
#Powershell | |
kubectl exec -i -t -n sitecore NAMEOFTHECMPOD -c cm "--" powershell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment