kubectl port-forward --namespace=<namespace> <pod> <localport>:<podport>
# JVM remote debug
kubectl port-forward --namespace=<namespace> <pod> 5005:5005
kubectl patch pvc <pvc> -p '{\"metadata\":{\"finalizers\":null}}' -n <namespace>
kubectl delete pvc <pvc> --grace-period=0 --force -n <namespace>
az aks show \
--resource-group myResourceGroup \
--name myAKSCluster \
--query apiServerAccessProfile.authorizedIpRanges
kubectl get pod -n <namespace>
kubectl exec -it <podname> -n <namespace> -- printenv
kubectl describe cm my-configmap -n <namespace>
kubectl delete pod -l app=my-killer-app
kubectl get pods -l app=my-killer-app
alias devkube "kubectl config use-context kube-dev-context"
alias stgkube "kubectl config use-context kube-stg-context"
alias prdkube "kubectl config use-context kube-prd-context"
kubectl top [node|pod]
kubectl get deployments -n <namespace>
kubectl rollout restart deployment <deployment> -n <namespace>
kubectl get deployments -n <namespace>
kubectl scale deployment --replicas=0 <deployment> -n <namespace>
kubectl scale deployment --replicas=x <deployment> -n <namespace>
kubectl get pod -w -n <namespace>
http_application_routing
: configure ingress with automatic public DNS name creation.monitoring
: turn on Log Analytics monitoringvirtual-node
: enable AKS Virtual Nodeazure-policy
:ingress-appgw
: enable Application Gateway Ingress Controller addon.
kubectl get pod
kubectl logs <podname>
kubectl logs --follow <podname>
Or use labels
kubectl logs -l app=my-killer-app --follow
kubectl get pod
kubectl exec --stdin --tty mysql-694d95668d-w7lv5 -- /bin/bash
- Can not be the primary pool on the AKS cluster
- AKS version can not be upgrade
- Needs to be VMSS based
az aks nodepool add --resource-group ResourceGroup --cluster-name AKSCluster --name spotnodepool --priority Spot --eviction-policy Delete --spot-max-price 1 --enable-cluster-autoscaler --min-count 1 --max-count 3 --no-wait
# Get name of node pool
az aks show --resource-group myResourceGroup --name myAKSCluster --query agentPoolProfiles
# Scale node pool
az aks scale --resource-group myResourceGroup --name myAKSCluster --node-count 1 --nodepool-name <your node pool name>
In case you forgot to enable it while deploying the AKS cluster
az aks enable-addons --addons http_application_routing -n <aks-cluster> -g <resource-group>
az aks get-credentials -g <resource-group> -n <aks-cluster>
kubectl get nodes
[...]
az aks update -n <aks-cluster> -g <resource-group> --attach-acr <acr-name>
kubectl config set-context --current --namespace=foobar
kubectl config get-contexts
kubectl config use-context ...