kubelet是Kubernetes中的核心組件,須要在每個節點安裝,也是kubernetes集羣啓動的第一個服務。kubelet的參數存放在多個目錄,修改時若是不完整就會致使各類錯誤,下面咱們kubelet的參數存放位置和配置方法一探究竟。node
在Ubuntu18.04上kubelet是使用宿主機的systemd來啓動的,目前kubernetes 1.12.3爲止都尚未將其容器化。git
kubelet的配置參數存放在三個不一樣的目錄:github
位於/var/lib/kubelet,包含本機由kubelet管理的全部資源。web
supermap@podc01:/var/lib/kubelet$ tree . ├── config.yaml ├── cpu_manager_state ├── device-plugins │ ├── DEPRECATION │ ├── kubelet_internal_checkpoint │ └── kubelet.sock ├── kubeadm-flags.env ├── pki │ ├── kubelet-client-2018-11-23-10-08-12.pem │ ├── kubelet-client-2018-11-23-10-08-38.pem │ ├── kubelet-client-current.pem -> /var/lib/kubelet/pki/kubelet-client-2018-11-23-10-08-38.pem │ ├── kubelet.crt │ └── kubelet.key ├── plugin-containers [error opening dir] ├── plugins [error opening dir] ├── plugins_registry [error opening dir] ├── pod-resources [error opening dir] └── pods [error opening dir] 7 directories, 11 files
其中config.yaml的內容以下:api
address: 10.1.1.201 apiVersion: kubelet.config.k8s.io/v1beta1 authentication: anonymous: enabled: false webhook: cacheTTL: 2m0s enabled: true x509: clientCAFile: /etc/kubernetes/pki/ca.crt authorization: mode: Webhook webhook: cacheAuthorizedTTL: 5m0s cacheUnauthorizedTTL: 30s cgroupDriver: cgroupfs cgroupsPerQOS: true clusterDNS: - 10.96.0.10 clusterDomain: cluster.local configMapAndSecretChangeDetectionStrategy: Watch containerLogMaxFiles: 5 containerLogMaxSize: 10Mi contentType: application/vnd.kubernetes.protobuf cpuCFSQuota: true cpuCFSQuotaPeriod: 100ms cpuManagerPolicy: none cpuManagerReconcilePeriod: 10s enableControllerAttachDetach: true enableDebuggingHandlers: true enforceNodeAllocatable: - pods eventBurst: 10 eventRecordQPS: 5 evictionHard: imagefs.available: 15% memory.available: 100Mi nodefs.available: 10% nodefs.inodesFree: 5% evictionPressureTransitionPeriod: 5m0s failSwapOn: true fileCheckFrequency: 20s hairpinMode: promiscuous-bridge healthzBindAddress: 127.0.0.1 healthzPort: 10248 httpCheckFrequency: 20s imageGCHighThresholdPercent: 85 imageGCLowThresholdPercent: 80 imageMinimumGCAge: 2m0s iptablesDropBit: 15 iptablesMasqueradeBit: 14 kind: KubeletConfiguration kubeAPIBurst: 10 kubeAPIQPS: 5 makeIPTablesUtilChains: true maxOpenFiles: 1000000 maxPods: 110 nodeLeaseDurationSeconds: 40 nodeStatusUpdateFrequency: 10s oomScoreAdj: -999 podPidsLimit: -1 port: 10250 registryBurst: 10 registryPullQPS: 5 resolvConf: /etc/resolv.conf rotateCertificates: true runtimeRequestTimeout: 2m0s serializeImagePulls: true staticPodPath: /etc/kubernetes/manifests streamingConnectionIdleTimeout: 4h0m0s syncFrequency: 1m0s volumeStatsAggPeriod: 1m0s