Development & AI | Alper Akgun
# Cluster info
kubectl cluster-info
kubectl config view
kubectl api-resources
kubectl version
kubectl api-versions
# List everything. "-A" or "-all-namespaces" or "-n my_namespace"
kubectl get all -A
kubectl get pods -o wide
kubectl get pods -n FOONAMESPACE -o wide
kubectl get pod FOOPOD -o yaml
# Namespaces
kubectl create namespace FOONAMESPACE
kubectl get namespace FOONAMESPACE
kubectl describe namespace FOONAMESPACE
kubectl delete namespace FOONAMESPACE
# Pods
kubectl get pod
kubectl delete pod FOOPOD
kubectl describe pod FOOPOD
kubectl create pod FOOPOD
kubectl exec FOOPOD -c FOOCONTAINER DO_MY_COMMAND
kubectl exec -it FOOPOD /bin/sh
kubectl top pod
kubectl annotate pod
kubectl label pod
# Services
kubectl get services
kubectl describe services
kubectl expose deployment FOODEPLOYMENT
# Secrets
kubectl create secret
kubectl get secret
kubectl describe secret
kubectl delete secret FOOSECRET
# Nodes
kubectl get node
kubectl top node
# Deployments
kubectl get deployment
kubectl describe deployment FOO
kubectl edit deployment FOO
kubectl create deployment FOO
kubectl rollout status deployment FOO
# Logs
kubectl logs FOOPOD
kubectl logs --since=1h FOOPOD
kubectl logs --tail=20 FOOPOD
kubectl logs -f FOOSERVICE [-c FOOCONTAINER]
kubectl logs -f FOOPOD
# manifest files: modify objects
kubectl apply -f FOO.yaml
kubectl apply -d ./FOODIR
kubectl delete -f FOO.yaml
# Daemonsets, events,
kubectl get events --field-selector type=Warning
kubectl get daemonset
kubectl get serviceaccounts