k8s组件时区修改
一、etcd、apiserver、controller-manager、scheduler时区修改
1、修改master服务器上/etc/kubernetes/manifests/目录下的yaml文件
[root@master ~]# ll /etc/kubernetes/manifests/ total 16 -rw------- 1 root root 2361 May 10 10:53 etcd.yaml -rw------- 1 root root 3522 May 10 10:49 kube-apiserver.yaml -rw------- 1 root root 2976 May 10 10:53 kube-controller-manager.yaml -rw------- 1 root root 1562 May 10 10:52 kube-scheduler.yaml
2、在yaml中挂载服务器的时区(内容如下)
volumeMounts: - mountPath: /etc/localtime name: host-time readOnly: true volumes: - hostPath: path: /etc/localtime name: host-time
3、查看修改后的kube-apiserver.yaml(其它几个文件都一样的修改)
[root@master ~]# cat /etc/kubernetes/manifests/kube-apiserver.yaml |tail -32 volumeMounts: - mountPath: /etc/ssl/certs name: ca-certs readOnly: true - mountPath: /etc/pki name: etc-pki readOnly: true - mountPath: /etc/kubernetes/pki name: k8s-certs readOnly: true - mountPath: /etc/localtime name: host-time readOnly: true hostNetwork: true priorityClassName: system-node-critical volumes: - hostPath: path: /etc/ssl/certs type: DirectoryOrCreate name: ca-certs - hostPath: path: /etc/pki type: DirectoryOrCreate name: etc-pki - hostPath: path: /etc/kubernetes/pki type: DirectoryOrCreate name: k8s-certs - hostPath: path: /etc/localtime name: host-time status: {}
二、修改kube-proxy的时区
1、直接edit kube-proxy的ds配置(挂载参数和上面一样)
kubectl edit ds -n kube-system kube-proxy
三、修改coredns时区
1、edit coredns配置,直接挂载服务器时区
kubectl edit deploy -n kube-system coredn