kubectl get nodes
kubectl get pods -o wide // show more columns
kubectl get pods -n kube-system // show pods in the system namespace
kubectl get pods -n demo // get the pods in the demo namespace
kubectl get pods -A // get pods from all namespaces
kubectl delete pods <pod-name>
kubectl describe pods
kubectl cluster-info
kubectl run gabors-pod1 --image=blazorapp2:1.3 --port=80
kubectl run blazorapp-pod --image=blazorapp2:1.3 --port=8080
kubectl expose deployment blazorapp-pod --type="LoadBalancer" --target-port=8080 --port=8080
kubectl create deployment demo-deploy1 --image=blazorapp2
kubectl get deploy[ments]
// Deployments create multiple clones of the same pod called Replicas
kubectl scale deploy demo-deploy1 --replicas=3
// Now if you delte a pod(s), the will be re-created
kubectl delete pods --all
// Pods get named after the deployment
kubectl get services
kubectl expose deploy demo-deploy1
kubectl port-forward demo-deploy1-7896db797f-6thf9 8080:8080
kubectl get namespace
kubectl describe ns demo // shows the resourcequotas for namespace demo
kubectl create ns demo // create a namespace
kubectl create namespace demo // create a namespace
kubectl describe ns demo // describe a namespace
kubectl apply -f "file.yaml"
kubectl apply -f "file.yaml" -n | --namespace demo // apply resource quota to namespace demo
kubectl get resourcequota mem-cpu-demo --namespace=demo --output=yaml // get the resourcequota
// kubectl exec -it <pod-name> [-n <namespace>] -- sh
kubectl exec -it demo-pod1 -n demo -- sh
Env. variables, configuration, etc. The ConfigMap gets mounted to the pod as a volume, then you mount the volume to the container.
kubectl create cm|configMap <name> --from file=fileName.txt
kubectl get pods --show-labels
kubectl label pod <pod-name> key=value // add a label at the cmd
kubectl label pods --selector=blue
kubectl get pods -L alta3 // add a column called alta3
kubectl label pods blazorapp2 alta3=awesome
kubectl get pods --selector=alta3=awesome