Skip to content

Instantly share code, notes, and snippets.

@jonashackt
Last active March 13, 2024 13:36
Show Gist options
  • Select an option

  • Save jonashackt/df283eb3f5ed587ee1f93cbcfc23be08 to your computer and use it in GitHub Desktop.

Select an option

Save jonashackt/df283eb3f5ed587ee1f93cbcfc23be08 to your computer and use it in GitHub Desktop.
Kubernetes cheat sheet
# See logs of K8s cluster
https://kubernetes.io/docs/tasks/debug-application-cluster/debug-cluster/#looking-at-logs
# show k8s api-server logging
sudo journalctl -u kube-apiserver --follow
#see https://kubernetes.io/docs/reference/kubectl/cheatsheet/
# Retrieve cluster info
kubectl cluster-info dump
# every component with namespace kube-system
kubectl get all --namespace kube-system
# every component
kubectl get all --all-namespaces
# etcd
## get all etcd entries
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/kube-apiserver.pem --key=/etc/etcd/kube-apiserver-key.pem get / --prefix --keys-only
# Networking
kubectl get nodes --output json
# Flannel logging
kubectl logs -n kube-system kube-flannel-ds-cw7kf -c kube-flannel
kubectl get pod kube-flannel-ds-cw7kf --namespace kube-system -o yaml
# Kube-DNS
kubectl describe pods -l k8s-app=kube-dns -n kube-system
kubectl get nodes --output=jsonpath='{range .items[*]}{.status.addresses[?(@.type=="InternalIP")].address} {.spec.podCIDR} {"\n"}{end}'
# CoreDNS
kubectl describe pod/coredns-65db874f4f-lz5hl --namespace kube-system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment