* [ ] liveness与readiness的原理区别
`liveness`主要用来确定何时重启容器。liveness探测的结果会存储在livenessManager中。kubelet在syncPod时,发现该容器的liveness探针检测失败时,会将其加入待启动的容器列表中,在之后的操作中会重新创建该容器。
`readiness`主要来确定容器是否已经就绪。只有当Pod中的容器都处于就绪状态,也就是pod的condition里的Ready为true时,kubelet才会认定该Pod处于就绪状态。而pod是否处于就绪状态的作用是控制哪些Pod应该作为service的后端。如果Pod处于非就绪状态,那么它们将会被从service的endpoint中移除。
* [ ] kubernetes的主组件如何做高可用
1. kube-apiserver:无状态服务,通过SLB方式负载到下面节点的8443端口
2. kube-controller-manager:自动选主
3. kube-scheduler:自动选主
4. etcd:自动选主
* [ ] Kubernetes 宿主机上根据 PID 获取 Pod 名称
~~~
# 根据PID为1385的进程找到对应docker的信息
cat /proc/1385/cgroup
11:freezer:/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
10:pids:/system.slice/containerd.service/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
9:blkio:/system.slice/containerd.service/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
8:devices:/system.slice/containerd.service/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
7:perf_event:/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
6:net_cls,net_prio:/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
5:memory:/system.slice/containerd.service/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
4:hugetlb:/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
3:cpuset:/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
2:cpu,cpuacct:/system.slice/containerd.service/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
1:name=systemd:/system.slice/containerd.service/kubepods-pod77902daf_dc8d_40e2_aed1_0fd320e351de.slice/def08692ee738a89b824f3a932a3447d0827558eb2d03720fe75bdba5aa1fedb
~~~
~~~
# 根据ContainerID找到宿主机的PID
[root@node01 5170]# docker top def08692ee
UID PID PPID C STIME TTY TIME CMD
root 5170 5129 0 17:35 ? 00:00:00 nginx: master process nginx -g daemon off;
101 5229 5170 0 17:35 ? 00:00:00 nginx: worker process
~~~
* [ ] croedns挂掉一个节点
* [ ] kubelet优化
1。--pod-max-pids=50000,设置每个pod的pid数量
2。--allow-privileged=true,开放所有权限
3。--fail-swap-on=false,关闭swap内存
4。--max-pods=254,设置一个node最多的pod个数