CKA-备考

资料来源: https://github.com/walidshaari/Kubernetes-Certified-Administrator

先执行 source (kubectl completion bash)


提示

  • 练习、练习、再练习

  • 熟悉文档,主要包括 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   # to drain a node
kubectl uncordon   # to return a node after updates back to the cluster from unscheduled state to Ready
kubectl cordon     # to not schedule new pods on a node

upgrade kubernetes worker node

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

kubeadm upgrade steps

kubeadm upgrade plan
kubeadm upgrade apply

Troubleshooting – 30%

如何监控应用?

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

应用为什么失败?

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/

你可能感兴趣的:(CKA-备考)