Last active
August 10, 2021 09:01
-
-
Save rezamt/f0a8ee44727ac86a27a8b78b234b18b0 to your computer and use it in GitHub Desktop.
Kubernetes Exam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shortcut commands | |
alias k=kubectl | |
alias kgn='kubectl get ns' | |
alias kgp='kubectl get pods' | |
alias kgs='kubectl get service' | |
alias kgd='kubectl get deployment' | |
alias kep='kubectl edit pod' | |
alias ked='kubectl edit deployment' | |
alias kes='kubectl edit service' | |
# set default namespace | |
alias ksn='kubectl config set-context --current --namespace' | |
# journalctl | |
journalctl -u kube-apiserver | |
journalctl -u kubelet | |
# Static Pods | |
## Option-01 | |
### updating the kubelet service configuration file and adding parameter --manifest= to yaml file | |
vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | |
# and add --manifest-url= | |
### example | |
echo ` | |
[Unit] | |
Wants=docker.socket | |
[Service] | |
ExecStart= | |
ExecStart=/var/lib/minikube/binaries/v1.21.2/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime=docker --hostname-override=minikube --kubeconfig=/etc/kubernetes/kubelet.conf --node-ip=192.168.99.105 --manifest-url=https://gist.githubusercontent.com/rezamt/6e0b1b1b2fea42317ff420d11654fa69/raw/4f2f023223e8484de6fd6480b9721b3590201248/webpod.yaml | |
[Install]` > | |
systemctl reload kubelet | |
systemctl restart kubelet | |
# Option 02 - check the path inside the kubelet/config.yaml | |
grep ^staticPodPath /var/lib/kubelet/config.yaml | |
# result: staticPodPath: /etc/kubernetes/manifests | |
# now just add your static config yaml under folder /etc/kubernetes/manifests. | |
systemctl restart kubelet | |
# All api-server, scheduler, controller, kubelet configuration when you setup using kubeadm can be found under: | |
/etc/kubernetes/manifests | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/kubectl/kubectl.plugin.zsh