Kubernetes Cookbok

Quick command snippets to interact with Kubernetes.

  • kubectl get pods selector app=somesystem
  • kubectl get jobs
  • kubectl exec -it podname -- bash
  • kubectl proxy -p 8123
  • kubectl replace -f blah
  • kubectl scale deployment appname replicas=3
  • kubectl describe podname
  • kubectl port-forward
  • kubectl get configmaps
  • kubectl get configmaps blah-config -o yml
  • kubectl delete pods --selector app=card
  • kubectl apply -f kube/deployment.yml
  • kubectl apply -f kube/test/config/configmap.yml
  • kubectl
  • kube create secret docker-registry gcr-registry --dry-run -o yaml --docker-server=https://gcr.io --docker-username=_json_key [email protected] --docker-password=(jq -c . gcp-service-account.json ) > gcr-registry.yml
  • kubeseal --format=yaml \ --cert=sealed-secrets-cert.pem \ < gcr-registry.yml \ > secret-gcr-registry.yml