CKA-備考

資料來源: https://github.com/walidshaari/Kubernetes-Certified-Administrator

先執(zhí)行 source (kubectl completion bash)


提示

  • 練習(xí)、練習(xí)、再練習(xí)

  • 熟悉文檔,主要包括 concepts 和 tasks
    https://kubernetes.io/docs/concepts/
    https://kubernetes.io/docs/tasks/

  • 盡量熟悉 kubectl 命令,例如

    kubectl explain --recursive
    source <(kubectl completion bash)
    alias k=kubectl
    complete -F __start_kubectl k
    kubectl get pod -A -owide --show-labels --sort-by='{.metadata.name}'
    kubectl describe pod {podname}
    kubectl logs {podname}
    kubectl run testpod --image=nginx --dry-run=client -oyaml
    

Cluster Architecture, Installation, and Configuration 25%

etcd backup and restore brief

export ETCDCTL_API=3  # needed to specify etcd api versions, not sure if it is needed anylonger with k8s 1.19+ 
etcdctl snapshot save -h   #find save options
etcdctl snapshot restore -h  #find restore options

# possible example of save, options will change depending on cluster context, as TLS is used need to give ca,crt, and key paths
etcdctl snapshot save /backup/snapshot.db  \
  --cert=/etc/kubernetes/pki/etcd/server.crt  \
  --key=/etc/kubernetes/pki/etcd/server.key \
  --cacert=/etc/kubernetes/pki/etcd/ca.crt

evicting pods/nodes and bringing back node back to cluster

kubectl drain  <node> # to drain a node
kubectl uncordon  <node> # to return a node after updates back to the cluster from unscheduled state to Ready
kubectl cordon  <node>   # to not schedule new pods on a node

upgrade kubernetes worker node

kubectl drain <node>
apt-get upgrade -y kubeadm=<k8s-version-to-upgrade>
apt-get upgrade -y kubelet=<k8s-version-to-upgrade>
kubeadm upgrade node config --kubelet-version <k8s-version-to-upgrade>
systemctl restart kubelet
kubectl uncordon <node>

kubeadm upgrade steps

kubeadm upgrade plan
kubeadm upgrade apply

Troubleshooting – 30%

如何監(jiān)控應(yīng)用?

https://kubernetes.io/docs/tasks/debug-application-cluster/resource-usage-monitoring/

應(yīng)用為什么失???

https://kubernetes.io/docs/tasks/debug-application-cluster/debug-application/

集群為什么出問題了?

https://kubernetes.io/docs/tasks/debug-application-cluster/debug-cluster/

DNS為什么不能解析了?

https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容