Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What about the directory structure of Kubernetes configuration files?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to look at the directory structure of the Kubernetes configuration file. I hope you will get something after reading this article. Let's discuss it together.

The configuration directories for Kubernetes include / etc/kubernetes, / home/supermap/.kube, and / var/lib/kubelet directories.

Let's take a look at what files are in these directories (the operating system uses Ubuntu 18.04LTS desktop).

Install the tree command:

Sudo apt install tree1, kubernetes main configuration directory

Show / etc/kubernetes directory structure:

Supermap@podc01:/etc/kubernetes$ tree.. ├── admin.conf ├── controller-manager.conf ├── kubelet.conf ├── manifests │ ├── etcd.yaml │ ├── kube-apiserver.yaml │ ├── kube-controller-manager.yaml │ └── kube-scheduler.yaml ├── pki │ ├── apiserver.crt │ ├── apiserver-etcd-client.crt │ ├── apiserver-etcd-client.key ├── apiserver.key │ ├── apiserver-kubelet-client.crt │ ├── apiserver-kubelet-client.key │ ├── ca.crt │ ├── ca.key │ ├── etcd │ │ ├── ca.crt │ │ ├── ca.key │ │ healthcheck-client.crt healthcheck-client.key peer .crt │ │ ├── peer.key │ │ ├── server.crt │ │ └── server.key │ ├── front-proxy-ca.crt │ ├── front-proxy-ca.key │ ├── front-proxy-client.crt │ ├── front-proxy-client.key │ ├── sa.key sa.pub scheduler.conf tmp [error opening dir] 4 directories 30 files2, kubernetes user configuration directory

The hidden directory under the main user directory. Kube contains the user's configuration parameters and cached data. The directory structure is:

/ home/supermap/.kube ├── cache │ └── discovery │ ├── 10.1.1.181_6443 │ └── 10.1.1.201_6443 ├── config └── http-cache ├── 028d83935e12ce471cbe29f4096ef4ed

The configuration file config is composed of:

ApiVersion: v1clusters LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t...-cluster: certificate-authority-data: Server: https://10.1.1.201:6443 name: kubernetescontexts:- context: cluster: kubernetes user: kubernetes-admin name: kubernetes-admin@kubernetescurrent-context: kubernetes-admin@kuberneteskind: Configpreferences: {} users:- name: kubernetes-admin user: client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1... Client-key-data: the configuration directory of LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUl...3 and kubelet services

Each ks node needs to run the kubelet service. The kubelet service is configured in the / var/lib/kubelet directory:

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 files4, kubelet.service service directory

Kubelet is managed using systemd, and the service definition file is located at: / lib/systemd/system/kubelet.service.

The latest dropin file is located at: / etc/systemd/system/kubelet.service.d and contains:

Supermap@podc01:/etc/systemd/system/kubelet.service.d$ cat 10-kubeadm.conf # Note: This dropin only works with kubeadm and kubelet v1.11 + [service] Environment= "KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf-- kubeconfig=/etc/kubernetes/kubelet.conf" Environment= "KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" # This is a file that "kubeadm init" and "kubeadm join" generates at runtime Populating the KUBELET_KUBEADM_ARGS variable dynamicallyEnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.EnvironmentFile=-/etc/default/kubeletExecStart=ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS

As you can see, the configuration of this kublet service parameter has changed greatly in the new kubernetes configuration structure. The startup parameters are no longer in the kubelet.service file, but in / var/lib/kubelet, / etc/default/kubelet.

Note that this change may cause many previously manually installed scripting tools to be no longer available.

After reading this article, I believe you have a certain understanding of "how to look at the directory structure of Kubernetes configuration files". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report