3

kubeadm init --config [file.yaml] 后实际配置与 yaml 里的配置不符

 1 year ago
source link: https://www.v2ex.com/t/925230
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Kubernetes

kubeadm init --config [file.yaml] 后实际配置与 yaml 里的配置不符

  OldCarMan · 1 小时 16 分钟前 · 65 次点击

今天使用 kubeadm reset 后,再使用 kubeadm init 来重新初始化 k8s 时,发现初始化后实际配置跟我 yaml 设定的配置不一样。

具体情况,打个比方:我 yaml 文件里面 criSocket(参考文档)配置的是:

criSocket: unix:///var/run/cri-dockerd.sock

然而实际情况得到的 criSocket 则是:

criSocket: unix:///var/run/containerd/containerd.sock
下面是我 init 初始化日志&yaml 配置&InitConfiguration 实际配置结果:
  • 这是调用 kubeadm init 初始化成功输出(没报错):
root@master1 ~/k8s/]# kubeadm init --config=/root/k8s/kubeadm/config.yaml --upload-certs
[init] Using Kubernetes version: v1.26.0
[preflight] Running pre-flight checks
	[WARNING FileExisting-tc]: tc not found in system path
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'

...

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config
  • 这是我的 yaml 配置文件:
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
nodeRegistration:
  criSocket: unix:///var/run/cri-dockerd.sock
  kubeletExtraArgs:
    runtime-cgroups: /system.slice/docker.service
    pod-infra-container-image: registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.7

---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: ipvs
ipvs:
  minSyncPeriod: 8s
  syncPeriod: 8s
  scheduler: 'wrr'
  
  ....(省略其他配置)

  • 这是我运行kubeadm config print init-defaults后 输出的实际配置日志
[root@master1 k8s]# kubeadm config print init-defaults
apiVersion: kubeadm.k8s.io/v1beta3
bootstrapTokens:
- groups:
  - system:bootstrappers:kubeadm:default-node-token
  token: abcdef.0123456789abcdef
  ttl: 24h0m0s
  usages:
  - signing
  - authentication
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: 1.2.3.4
  bindPort: 6443
nodeRegistration:
  criSocket: unix:///var/run/containerd/containerd.sock
  imagePullPolicy: IfNotPresent
  name: node
  taints: null
---

.....(省略其他配置)

  • 大佬们觉得是什么问题,另外大家平时是怎么部署 k8s 集群的,谢谢大家回复。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK