Skip to main content

K8s

Add clusters to .kube/config

> az login
> az account set --subscription 731f260b-aaaa-46c3-88f7-3e00b0e53aaa
> az aks get-credentials --resource-group rg-name --name k8s-name
...
> aws sso login
> aws eks update-kubeconfig --region eu-north-1 --name staking-aws-development-argo

Switch between contexts

> kubectl config use-context my-cluster
> kubectl get ns
> kubectl config set-context --current --namespace=my-namespace

or better by using the kubeselect and kubens tools

Applying changes

> kubectl apply -f kubernetes
> kubectl apply -f file.yml

Top commands

COMMANDDESCRIPTION
kubectl get nodes -o wideGet info of all nodes
kubectl -n my-namespace get svcGet services
kubectl -n my-namespace get podsGet pods
kubectl -n my-namespace describe pod stack-66c75978f9-szjz5Show info of pod
kubectl -n my-namespace exec -it stack-66c75978f9-szjz5 -- shRun console inside pod
kubectl -n my-namespace delete deployment <dep_id>Kill a deployment
kubectl -n kss-local delete service <serv_id>Kill a service
stern -s 5m stack-66c75978f9-szjz5Show logs on local console