kubectx
kubens
kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
kubens default
kubectl get pods dnsutils
kubectl exec -i -t dnsutils -- nslookup kubernetes.default
https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/
kubectl get pods --all-namespaces --field-selector 'status.phase==Failed'
kubectl scale --current-replicas=6 --replicas=8 deployment -l app=production
kubectl delete pods,services,deployments -l app={_text-used-in-app-label_}
kubectl describe pod -l role={_role-name_} | grep IP\:\ | sed "s/IP:/ /g" | tr -d '[:space:]'
kubectl describe pod {_pod-name_}
kubectl get hpa
kubectl describe pod | grep Node:
kubectl describe pod {_pod-name_} | grep Node:
kubectl exec -it {_pod-name_} -- /bin/sh
kubectl port-forward {_pod-name_} {_local-port_}:{_container-port_}
kubectl rollout restart deployment {_deployment-name_}
kubectl logs {_pod-name_} --follow=true
kubectl logs {_pod-name_} | grep -A 10 80409001331404
kubectl logs {_pod-name_} --follow=true | grep CT000409
kubectl logs -l app={_app-label_} -f | grep 123456879
kubectl get nodes
for node in $(kubectl get nodes -l cloud.google.com/gke-nodepool=default-pool -o=name); do
kubectl cordon "$node";
done
kubectl delete node {_node-name_}
for node in $(kubectl get nodes -l cloud.google.com/gke-nodepool=default-pool -o=name); do
kubectl drain --force --ignore-daemonsets --delete-local-data --grace-period=10 "$node";
done
kubectl drain {_node-name_} --ignore-daemonsets --delete-local-data
gcloud container node-pools delete {_node-name-pool_} --cluster {_cluster-name_}
kubectl get rs
kubectl get deployments
kubectl autoscale deployment {_deployment-name_} --min=1 --max=3 --cpu-percent=85
kubectl scale deployment {_deployment-name_} --replicas=10
sudo docker build -t xpto .
sudo docker run -d -p 3333:5000 xpto
sudo docker image rm xpto -f
sudo docker container rm aaa111
sudo docker container stop aaa111
docker exec -it aaa111 /bin/bash
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)