视频版
https://www.bilibili.com/video/BV1gL411Y75L
背景
上次尝试了k3s,本来计划是尝试原版k8s,但看了下文档感觉略麻烦,我决定放弃。。。。
按上次eric的建议这次尝试玩下kubekey
安装准备
环境要求
Ubuntu 16.04,18.04,20.04CPU:2 核,内存:4 G,硬盘:40 G
机器节点2c4g * 3
- 所有节点必须都能通过
SSH
访问。 - 所有节点时间同步。
- 所有节点都应使用
sudo
/curl
/openssl
/tar
生成config
0 1 2 3 4 5 6 7 8 9 10 11 |
k8s1@k8s1:~$ export KKZONE=cn k8s1@k8s1:~$ curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh - Downloading kubekey v3.0.7 from https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/v3.0.7/kubekey-v3.0.7-linux-amd64.tar.gz ... Kubekey v3.0.7 Download Complete! k8s1@k8s1:~$ chmod +x kk k8s1@k8s1:~$ ./kk create config --with-kubesphere --with-kubesphere Generate KubeKey config file successfully k8s1@k8s1:~$ ls config-sample.yaml kk kubekey-v3.0.7-linux-amd64.tar.gz k8s1@k8s1:~$ |
修改config
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
k8s1@k8s1:~$ vim config-sample.yaml k8s1@k8s1:~$ cat config-sample.yaml apiVersion: kubekey.kubesphere.io/v1alpha2 kind: Cluster metadata: name: sample spec: hosts: - {name: master, address: 192.168.2.206, internalAddress: 192.168.2.206, user: k8s1, password: 123456} - {name: node1, address: 192.168.2.177, internalAddress: 192.168.2.177, user: k8s2, password: 123456} - {name: node2, address: 192.168.2.203, internalAddress: 192.168.2.203, user: k8s3, password: 123456} roleGroups: etcd: - master control-plane: - master worker: - node1 - node2 controlPlaneEndpoint: ## Internal loadbalancer for apiservers # internalLoadbalancer: haproxy domain: kubesphere.k8s.local address: "" port: 6443 kubernetes: version: v1.23.10 clusterName: cluster.local autoRenewCerts: true containerManager: docker etcd: type: kubekey network: plugin: calico kubePodsCIDR: 10.233.64.0/18 kubeServiceCIDR: 10.233.0.0/18 ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni multusCNI: enabled: false registry: privateRegistry: "" namespaceOverride: "" registryMirrors: [] insecureRegistries: [] addons: [] --- apiVersion: installer.kubesphere.io/v1alpha1 kind: ClusterConfiguration metadata: name: ks-installer namespace: kubesphere-system labels: version: v3.3.2 spec: persistence: storageClass: "" authentication: jwtSecret: "" zone: "" local_registry: "" namespace_override: "" # dev_tag: "" etcd: monitoring: false endpointIps: localhost port: 2379 tlsEnable: true common: core: console: enableMultiLogin: true port: 30880 type: NodePort # apiserver: # resources: {} # controllerManager: # resources: {} redis: enabled: false volumeSize: 2Gi openldap: enabled: false volumeSize: 2Gi minio: volumeSize: 20Gi monitoring: # type: external endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 GPUMonitoring: enabled: false gpu: kinds: - resourceName: "nvidia.com/gpu" resourceType: "GPU" default: true es: # master: # volumeSize: 4Gi # replicas: 1 # resources: {} # data: # volumeSize: 20Gi # replicas: 1 # resources: {} logMaxAge: 7 elkPrefix: logstash basicAuth: enabled: false username: "" password: "" externalElasticsearchHost: "" externalElasticsearchPort: "" alerting: enabled: false # thanosruler: # replicas: 1 # resources: {} auditing: enabled: false # operator: # resources: {} # webhook: # resources: {} devops: enabled: false # resources: {} jenkinsMemoryLim: 8Gi jenkinsMemoryReq: 4Gi jenkinsVolumeSize: 8Gi events: enabled: false # operator: # resources: {} # exporter: # resources: {} # ruler: # enabled: true # replicas: 2 # resources: {} logging: enabled: false logsidecar: enabled: true replicas: 2 # resources: {} metrics_server: enabled: false monitoring: storageClass: "" node_exporter: port: 9100 # resources: {} # kube_rbac_proxy: # resources: {} # kube_state_metrics: # resources: {} # prometheus: # replicas: 1 # volumeSize: 20Gi # resources: {} # operator: # resources: {} # alertmanager: # replicas: 1 # resources: {} # notification_manager: # resources: {} # operator: # resources: {} # proxy: # resources: {} gpu: nvidia_dcgm_exporter: enabled: false # resources: {} multicluster: clusterRole: none network: networkpolicy: enabled: false ippool: type: none topology: type: none openpitrix: store: enabled: false servicemesh: enabled: false istio: components: ingressGateways: - name: istio-ingressgateway enabled: false cni: enabled: false edgeruntime: enabled: false kubeedge: enabled: false cloudCore: cloudHub: advertiseAddress: - "" service: cloudhubNodePort: "30000" cloudhubQuicNodePort: "30001" cloudhubHttpsNodePort: "30002" cloudstreamNodePort: "30003" tunnelNodePort: "30004" # resources: {} # hostNetWork: false iptables-manager: enabled: true mode: "external" # resources: {} # edgeService: # resources: {} terminal: timeout: 600 |
每个节点上安装依赖项
0 1 |
sudo apt install -y socat conntrack ebtables ipset |
任务机上执行这个安装集群
0 1 |
./kk create cluster -f config-sample.yaml |
安装过程
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
k8s1@k8s1:~$ ./kk create cluster -f config-sample.yaml _ __ _ _ __ | | / / | | | | / / | |/ / _ _| |__ ___| |/ / ___ _ _ | \| | | | '_ \ / _ \ \ / _ \ | | | | |\ \ |_| | |_) | __/ |\ \ __/ |_| | \_| \_/\__,_|_.__/ \___\_| \_/\___|\__, | __/ | |___/ 13:11:55 UTC [GreetingsModule] Greetings 13:11:57 UTC message: [master] Greetings, KubeKey! 13:11:58 UTC message: [node2] Greetings, KubeKey! 13:11:59 UTC message: [node1] Greetings, KubeKey! 13:11:59 UTC success: [master] 13:11:59 UTC success: [node2] 13:11:59 UTC success: [node1] 13:11:59 UTC [NodePreCheckModule] A pre-check on nodes 13:12:00 UTC success: [node2] 13:12:00 UTC success: [node1] 13:12:00 UTC success: [master] 13:12:00 UTC [ConfirmModule] Display confirmation form +--------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+ | name | sudo | curl | openssl | ebtables | socat | ipset | ipvsadm | conntrack | chrony | docker | containerd | nfs client | ceph client | glusterfs client | time | +--------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+ | master | y | y | y | y | y | y | | y | | | | | | | UTC 13:12:00 | | node1 | y | y | y | y | y | y | | y | | | | | | | UTC 13:12:00 | | node2 | y | y | y | y | y | y | | y | | | | | | | UTC 13:12:00 | +--------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+ This is a simple check of your environment. Before installation, ensure that your machines meet all requirements specified at https://github.com/kubesphere/kubekey#requirements-and-recommendations Continue this installation? [yes/no]: yes 13:12:35 UTC success: [LocalHost] 13:12:35 UTC [NodeBinariesModule] Download installation binaries 13:12:35 UTC message: [localhost] downloading amd64 kubeadm v1.23.10 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 43.1M 100 43.1M 0 0 1012k 0 0:00:43 0:00:43 --:--:-- 983k 13:13:20 UTC message: [localhost] downloading amd64 kubelet v1.23.10 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 118M 100 118M 0 0 1022k 0 0:01:58 0:01:58 --:--:-- 1072k 13:15:21 UTC message: [localhost] downloading amd64 kubectl v1.23.10 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 44.4M 100 44.4M 0 0 1031k 0 0:00:44 0:00:44 --:--:-- 1185k 13:16:07 UTC message: [localhost] downloading amd64 helm v3.9.0 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 44.0M 100 44.0M 0 0 1021k 0 0:00:44 0:00:44 --:--:-- 1028k 13:16:52 UTC message: [localhost] downloading amd64 kubecni v0.9.1 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 37.9M 100 37.9M 0 0 1041k 0 0:00:37 0:00:37 --:--:-- 1194k 13:17:30 UTC message: [localhost] downloading amd64 crictl v1.24.0 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 13.8M 100 13.8M 0 0 1080k 0 0:00:13 0:00:13 --:--:-- 1218k 13:17:43 UTC message: [localhost] downloading amd64 etcd v3.4.13 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16.5M 100 16.5M 0 0 1034k 0 0:00:16 0:00:16 --:--:-- 1085k 13:18:00 UTC message: [localhost] downloading amd64 docker 20.10.8 ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 58.1M 100 58.1M 0 0 6954k 0 0:00:08 0:00:08 --:--:-- 7063k 13:18:10 UTC success: [LocalHost] 13:18:10 UTC [ConfigureOSModule] Get OS release 13:18:10 UTC success: [node1] 13:18:10 UTC success: [master] 13:18:10 UTC success: [node2] 13:18:10 UTC [ConfigureOSModule] Prepare to init OS 13:18:11 UTC success: [node1] 13:18:11 UTC success: [node2] 13:18:11 UTC success: [master] 13:18:11 UTC [ConfigureOSModule] Generate init os script 13:18:12 UTC success: [node1] 13:18:12 UTC success: [node2] 13:18:12 UTC success: [master] 13:18:12 UTC [ConfigureOSModule] Exec init os script 13:18:15 UTC stdout: [node1] net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-arptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_local_reserved_ports = 30000-32767 vm.max_map_count = 262144 vm.swappiness = 1 fs.inotify.max_user_instances = 524288 kernel.pid_max = 65535 13:18:15 UTC stdout: [node2] net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-arptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_local_reserved_ports = 30000-32767 vm.max_map_count = 262144 vm.swappiness = 1 fs.inotify.max_user_instances = 524288 kernel.pid_max = 65535 13:18:16 UTC stdout: [master] net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-arptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_local_reserved_ports = 30000-32767 vm.max_map_count = 262144 vm.swappiness = 1 fs.inotify.max_user_instances = 524288 kernel.pid_max = 65535 13:18:16 UTC success: [node1] 13:18:16 UTC success: [node2] 13:18:16 UTC success: [master] 13:18:16 UTC [ConfigureOSModule] configure the ntp server for each node 13:18:16 UTC skipped: [node2] 13:18:16 UTC skipped: [master] 13:18:16 UTC skipped: [node1] 13:18:16 UTC [KubernetesStatusModule] Get kubernetes cluster status 13:18:17 UTC success: [master] 13:18:17 UTC [InstallContainerModule] Sync docker binaries 13:18:30 UTC success: [node1] 13:18:30 UTC success: [node2] 13:18:30 UTC success: [master] 13:18:30 UTC [InstallContainerModule] Generate docker service 13:18:30 UTC success: [node1] 13:18:30 UTC success: [master] 13:18:30 UTC success: [node2] 13:18:30 UTC [InstallContainerModule] Generate docker config 13:18:30 UTC success: [node1] 13:18:30 UTC success: [node2] 13:18:30 UTC success: [master] 13:18:30 UTC [InstallContainerModule] Enable docker 13:18:49 UTC success: [node1] 13:18:49 UTC success: [node2] 13:18:49 UTC success: [master] 13:18:49 UTC [InstallContainerModule] Add auths to container runtime 13:18:49 UTC skipped: [node1] 13:18:49 UTC skipped: [master] 13:18:49 UTC skipped: [node2] 13:18:49 UTC [PullModule] Start to pull images on all nodes 13:18:49 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pause:3.6 13:18:49 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pause:3.6 13:18:49 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pause:3.6 13:18:50 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-apiserver:v1.23.10 13:18:50 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy:v1.23.10 13:18:50 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy:v1.23.10 13:19:00 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager:v1.23.10 13:19:00 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/coredns:1.8.6 13:19:01 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/coredns:1.8.6 13:19:05 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache:1.15.12 13:19:05 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache:1.15.12 13:19:09 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-scheduler:v1.23.10 13:19:14 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy:v1.23.10 13:19:15 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers:v3.23.2 13:19:16 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers:v3.23.2 13:19:34 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/coredns:1.8.6 13:19:37 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/cni:v3.23.2 13:19:37 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/cni:v3.23.2 13:19:40 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache:1.15.12 13:19:50 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers:v3.23.2 13:20:07 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/node:v3.23.2 13:20:07 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/node:v3.23.2 13:20:11 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/cni:v3.23.2 13:20:29 UTC message: [node1] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pod2daemon-flexvol:v3.23.2 13:20:29 UTC message: [node2] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pod2daemon-flexvol:v3.23.2 13:20:35 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/node:v3.23.2 13:20:55 UTC message: [master] downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pod2daemon-flexvol:v3.23.2 13:20:58 UTC success: [node1] 13:20:58 UTC success: [node2] 13:20:58 UTC success: [master] 13:20:58 UTC [ETCDPreCheckModule] Get etcd status 13:20:58 UTC success: [master] 13:20:58 UTC [CertsModule] Fetch etcd certs 13:20:58 UTC success: [master] 13:20:58 UTC [CertsModule] Generate etcd Certs [certs] Generating "ca" certificate and key [certs] admin-master serving cert is signed for DNS names [etcd etcd.kube-system etcd.kube-system.svc etcd.kube-system.svc.cluster.local kubesphere.k8s.local localhost master node1 node2] and IPs [127.0.0.1 ::1 192.168.2.206 192.168.2.177 192.168.2.203] [certs] member-master serving cert is signed for DNS names [etcd etcd.kube-system etcd.kube-system.svc etcd.kube-system.svc.cluster.local kubesphere.k8s.local localhost master node1 node2] and IPs [127.0.0.1 ::1 192.168.2.206 192.168.2.177 192.168.2.203] [certs] node-master serving cert is signed for DNS names [etcd etcd.kube-system etcd.kube-system.svc etcd.kube-system.svc.cluster.local kubesphere.k8s.local localhost master node1 node2] and IPs [127.0.0.1 ::1 192.168.2.206 192.168.2.177 192.168.2.203] 13:21:01 UTC success: [LocalHost] 13:21:01 UTC [CertsModule] Synchronize certs file 13:21:02 UTC success: [master] 13:21:02 UTC [CertsModule] Synchronize certs file to master 13:21:02 UTC skipped: [master] 13:21:02 UTC [InstallETCDBinaryModule] Install etcd using binary 13:21:04 UTC success: [master] 13:21:04 UTC [InstallETCDBinaryModule] Generate etcd service 13:21:04 UTC success: [master] 13:21:04 UTC [InstallETCDBinaryModule] Generate access address 13:21:04 UTC success: [master] 13:21:04 UTC [ETCDConfigureModule] Health check on exist etcd 13:21:04 UTC skipped: [master] 13:21:04 UTC [ETCDConfigureModule] Generate etcd.env config on new etcd 13:21:04 UTC success: [master] 13:21:04 UTC [ETCDConfigureModule] Refresh etcd.env config on all etcd 13:21:05 UTC success: [master] 13:21:05 UTC [ETCDConfigureModule] Restart etcd 13:21:09 UTC stdout: [master] Created symlink /etc/systemd/system/multi-user.target.wants/etcd.service → /etc/systemd/system/etcd.service. 13:21:09 UTC success: [master] 13:21:09 UTC [ETCDConfigureModule] Health check on all etcd 13:21:09 UTC success: [master] 13:21:09 UTC [ETCDConfigureModule] Refresh etcd.env config to exist mode on all etcd 13:21:10 UTC success: [master] 13:21:10 UTC [ETCDConfigureModule] Health check on all etcd 13:21:10 UTC success: [master] 13:21:10 UTC [ETCDBackupModule] Backup etcd data regularly 13:21:10 UTC success: [master] 13:21:10 UTC [ETCDBackupModule] Generate backup ETCD service 13:21:10 UTC success: [master] 13:21:10 UTC [ETCDBackupModule] Generate backup ETCD timer 13:21:10 UTC success: [master] 13:21:10 UTC [ETCDBackupModule] Enable backup etcd service 13:21:11 UTC success: [master] 13:21:11 UTC [InstallKubeBinariesModule] Synchronize kubernetes binaries 13:21:48 UTC success: [node1] 13:21:48 UTC success: [master] 13:21:48 UTC success: [node2] 13:21:48 UTC [InstallKubeBinariesModule] Synchronize kubelet 13:21:48 UTC success: [node1] 13:21:48 UTC success: [node2] 13:21:48 UTC success: [master] 13:21:48 UTC [InstallKubeBinariesModule] Generate kubelet service 13:21:49 UTC success: [node1] 13:21:49 UTC success: [node2] 13:21:49 UTC success: [master] 13:21:49 UTC [InstallKubeBinariesModule] Enable kubelet service 13:21:52 UTC success: [node2] 13:21:52 UTC success: [node1] 13:21:52 UTC success: [master] 13:21:52 UTC [InstallKubeBinariesModule] Generate kubelet env 13:21:52 UTC success: [node1] 13:21:52 UTC success: [master] 13:21:52 UTC success: [node2] 13:21:52 UTC [InitKubernetesModule] Generate kubeadm config 13:21:53 UTC success: [master] 13:21:53 UTC [InitKubernetesModule] Init cluster using kubeadm 13:22:30 UTC stdout: [master] W0407 13:21:53.232803 5651 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10] [init] Using Kubernetes version: v1.23.10 [preflight] Running pre-flight checks [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' [certs] Using certificateDir folder "/etc/kubernetes/pki" [certs] Generating "ca" certificate and key [certs] Generating "apiserver" certificate and key [certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local kubesphere.k8s.local localhost master master.cluster.local node1 node1.cluster.local node2 node2.cluster.local] and IPs [10.233.0.1 192.168.2.206 127.0.0.1 192.168.2.177 192.168.2.203] [certs] Generating "apiserver-kubelet-client" certificate and key [certs] Generating "front-proxy-ca" certificate and key [certs] Generating "front-proxy-client" certificate and key [certs] External etcd mode: Skipping etcd/ca certificate authority generation [certs] External etcd mode: Skipping etcd/server certificate generation [certs] External etcd mode: Skipping etcd/peer certificate generation [certs] External etcd mode: Skipping etcd/healthcheck-client certificate generation [certs] External etcd mode: Skipping apiserver-etcd-client certificate generation [certs] Generating "sa" key and public key [kubeconfig] Using kubeconfig folder "/etc/kubernetes" [kubeconfig] Writing "admin.conf" kubeconfig file [kubeconfig] Writing "kubelet.conf" kubeconfig file [kubeconfig] Writing "controller-manager.conf" kubeconfig file [kubeconfig] Writing "scheduler.conf" kubeconfig file [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Starting the kubelet [control-plane] Using manifest folder "/etc/kubernetes/manifests" [control-plane] Creating static Pod manifest for "kube-apiserver" [control-plane] Creating static Pod manifest for "kube-controller-manager" [control-plane] Creating static Pod manifest for "kube-scheduler" [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s [apiclient] All control plane components are healthy after 23.505779 seconds [upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace [kubelet] Creating a ConfigMap "kubelet-config-1.23" in namespace kube-system with the configuration for the kubelets in the cluster NOTE: The "kubelet-config-1.23" naming of the kubelet ConfigMap is deprecated. Once the UnversionedKubeletConfigMap feature gate graduates to Beta the default name will become just "kubelet-config". Kubeadm upgrade will handle this transition transparently. [upload-certs] Skipping phase. Please see --upload-certs [mark-control-plane] Marking the node master as control-plane by adding the labels: [node-role.kubernetes.io/master(deprecated) node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers] [mark-control-plane] Marking the node master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule] [bootstrap-token] Using token: 71j95c.vwt766fyex29car8 [bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles [bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to get nodes [bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials [bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token [bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster [bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace [kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key [addons] Applied essential addon: CoreDNS [addons] Applied essential addon: kube-proxy 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 Alternatively, if you are the root user, you can run: export KUBECONFIG=/etc/kubernetes/admin.conf You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/ You can now join any number of control-plane nodes by copying certificate authorities and service account keys on each node and then running the following as root: kubeadm join kubesphere.k8s.local:6443 --token 71j95c.vwt766fyex29car8 \ --discovery-token-ca-cert-hash sha256:57fac9b5408266f709d667f092e5fb7e140e56480e9d2d10796007af241202a8 \ --control-plane Then you can join any number of worker nodes by running the following on each as root: kubeadm join kubesphere.k8s.local:6443 --token 71j95c.vwt766fyex29car8 \ --discovery-token-ca-cert-hash sha256:57fac9b5408266f709d667f092e5fb7e140e56480e9d2d10796007af241202a8 13:22:30 UTC success: [master] 13:22:30 UTC [InitKubernetesModule] Copy admin.conf to ~/.kube/config 13:22:30 UTC success: [master] 13:22:30 UTC [InitKubernetesModule] Remove master taint 13:22:30 UTC skipped: [master] 13:22:30 UTC [InitKubernetesModule] Add worker label 13:22:30 UTC skipped: [master] 13:22:30 UTC [ClusterDNSModule] Generate coredns service 13:22:31 UTC success: [master] 13:22:31 UTC [ClusterDNSModule] Override coredns service 13:22:32 UTC stdout: [master] service "kube-dns" deleted 13:22:35 UTC stdout: [master] service/coredns created Warning: resource clusterroles/system:coredns is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically. clusterrole.rbac.authorization.k8s.io/system:coredns configured 13:22:35 UTC success: [master] 13:22:35 UTC [ClusterDNSModule] Generate nodelocaldns 13:22:35 UTC success: [master] 13:22:35 UTC [ClusterDNSModule] Deploy nodelocaldns 13:22:35 UTC stdout: [master] serviceaccount/nodelocaldns created daemonset.apps/nodelocaldns created 13:22:35 UTC success: [master] 13:22:35 UTC [ClusterDNSModule] Generate nodelocaldns configmap 13:22:36 UTC success: [master] 13:22:36 UTC [ClusterDNSModule] Apply nodelocaldns configmap 13:22:37 UTC stdout: [master] configmap/nodelocaldns created 13:22:37 UTC success: [master] 13:22:37 UTC [KubernetesStatusModule] Get kubernetes cluster status 13:22:37 UTC stdout: [master] v1.23.10 13:22:37 UTC stdout: [master] master v1.23.10 [map[address:192.168.2.206 type:InternalIP] map[address:master type:Hostname]] 13:22:44 UTC stdout: [master] I0407 13:22:41.146907 6828 version.go:255] remote version is much newer: v1.26.3; falling back to: stable-1.23 [upload-certs] Storing the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace [upload-certs] Using certificate key: 2f289571fc7a08495750bd040c609d138754bdb3b691e110dfc62d9e9a983a33 13:22:44 UTC stdout: [master] secret/kubeadm-certs patched 13:22:45 UTC stdout: [master] secret/kubeadm-certs patched 13:22:45 UTC stdout: [master] secret/kubeadm-certs patched 13:22:45 UTC stdout: [master] vbbjzr.kxrrp9i7ttjop1q5 13:22:45 UTC success: [master] 13:22:45 UTC [JoinNodesModule] Generate kubeadm config 13:22:46 UTC skipped: [master] 13:22:46 UTC success: [node1] 13:22:46 UTC success: [node2] 13:22:46 UTC [JoinNodesModule] Join control-plane node 13:22:46 UTC skipped: [master] 13:22:46 UTC [JoinNodesModule] Join worker node 13:22:54 UTC stdout: [node2] [preflight] Running pre-flight checks [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml' W0407 13:22:47.815262 4922 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10] W0407 13:22:47.827002 4922 utils.go:69] The recommended value for "resolvConf" in "KubeletConfiguration" is: /run/systemd/resolve/resolv.conf; the provided value is: /run/systemd/resolve/resolv.conf [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Starting the kubelet [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster. 13:22:54 UTC stdout: [node1] [preflight] Running pre-flight checks [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml' W0407 13:22:47.919379 4966 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10] W0407 13:22:47.929063 4966 utils.go:69] The recommended value for "resolvConf" in "KubeletConfiguration" is: /run/systemd/resolve/resolv.conf; the provided value is: /run/systemd/resolve/resolv.conf [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Starting the kubelet [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster. 13:22:54 UTC success: [node2] 13:22:54 UTC success: [node1] 13:22:54 UTC [JoinNodesModule] Copy admin.conf to ~/.kube/config 13:22:54 UTC skipped: [master] 13:22:54 UTC [JoinNodesModule] Remove master taint 13:22:54 UTC skipped: [master] 13:22:54 UTC [JoinNodesModule] Add worker label to master 13:22:54 UTC skipped: [master] 13:22:54 UTC [JoinNodesModule] Synchronize kube config to worker 13:22:55 UTC success: [node1] 13:22:55 UTC success: [node2] 13:22:55 UTC [JoinNodesModule] Add worker label to worker 13:22:55 UTC stdout: [node2] node/node2 labeled 13:22:55 UTC stdout: [node1] node/node1 labeled 13:22:55 UTC success: [node2] 13:22:55 UTC success: [node1] 13:22:55 UTC [DeployNetworkPluginModule] Generate calico 13:22:56 UTC success: [master] 13:22:56 UTC [DeployNetworkPluginModule] Deploy calico 13:22:58 UTC stdout: [master] configmap/calico-config created customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/caliconodestatuses.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipreservations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/kubecontrollersconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org created clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created clusterrole.rbac.authorization.k8s.io/calico-node created clusterrolebinding.rbac.authorization.k8s.io/calico-node created daemonset.apps/calico-node created serviceaccount/calico-node created deployment.apps/calico-kube-controllers created serviceaccount/calico-kube-controllers created poddisruptionbudget.policy/calico-kube-controllers created 13:22:58 UTC success: [master] 13:22:58 UTC [ConfigureKubernetesModule] Configure kubernetes 13:22:58 UTC success: [node2] 13:22:58 UTC success: [master] 13:22:58 UTC success: [node1] 13:22:58 UTC [ChownModule] Chown user $HOME/.kube dir 13:22:59 UTC success: [node1] 13:22:59 UTC success: [node2] 13:22:59 UTC success: [master] 13:22:59 UTC [AutoRenewCertsModule] Generate k8s certs renew script 13:23:00 UTC success: [master] 13:23:00 UTC [AutoRenewCertsModule] Generate k8s certs renew service 13:23:01 UTC success: [master] 13:23:01 UTC [AutoRenewCertsModule] Generate k8s certs renew timer 13:23:02 UTC success: [master] 13:23:02 UTC [AutoRenewCertsModule] Enable k8s certs renew service 13:23:03 UTC success: [master] 13:23:03 UTC [SaveKubeConfigModule] Save kube config as a configmap 13:23:05 UTC success: [LocalHost] 13:23:05 UTC [AddonsModule] Install addons 13:23:05 UTC success: [LocalHost] 13:23:05 UTC [DeployStorageClassModule] Generate OpenEBS manifest 13:23:05 UTC success: [master] 13:23:05 UTC [DeployStorageClassModule] Deploy OpenEBS as cluster default StorageClass 13:23:19 UTC success: [master] 13:23:19 UTC [DeployKubeSphereModule] Generate KubeSphere ks-installer crd manifests 13:23:20 UTC success: [master] 13:23:20 UTC [DeployKubeSphereModule] Apply ks-installer 13:23:28 UTC stdout: [master] namespace/kubesphere-system created serviceaccount/ks-installer created customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io created clusterrole.rbac.authorization.k8s.io/ks-installer created clusterrolebinding.rbac.authorization.k8s.io/ks-installer created deployment.apps/ks-installer created 13:23:28 UTC success: [master] 13:23:28 UTC [DeployKubeSphereModule] Add config to ks-installer manifests 13:23:28 UTC success: [master] 13:23:28 UTC [DeployKubeSphereModule] Create the kubesphere namespace 13:23:30 UTC success: [master] 13:23:30 UTC [DeployKubeSphereModule] Setup ks-installer config 13:23:31 UTC stdout: [master] secret/kube-etcd-client-certs created 13:23:31 UTC success: [master] 13:23:31 UTC [DeployKubeSphereModule] Apply ks-installer 13:23:34 UTC stdout: [master] namespace/kubesphere-system unchanged serviceaccount/ks-installer unchanged customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io unchanged clusterrole.rbac.authorization.k8s.io/ks-installer unchanged clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged deployment.apps/ks-installer unchanged clusterconfiguration.installer.kubesphere.io/ks-installer created 13:23:34 UTC success: [master] Please wait for the installation to complete: >>---> |
这时候可以进到命令行查看安装过程,ks-installer-86ddb55c5b-gwlhh就是安装的pod
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
k8s3@k8s3:~$ kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system calico-kube-controllers-676c86494f-q9d7f 1/1 Running 0 22m kube-system calico-node-hqj7k 1/1 Running 0 22m kube-system calico-node-pr98x 1/1 Running 0 22m kube-system calico-node-xf7bt 1/1 Running 0 22m kube-system coredns-757cd945b-lx6mw 1/1 Running 0 22m kube-system coredns-757cd945b-ns8hj 1/1 Running 0 22m kube-system kube-apiserver-master 1/1 Running 0 23m kube-system kube-controller-manager-master 1/1 Running 0 23m kube-system kube-proxy-6bdxm 1/1 Running 0 22m kube-system kube-proxy-ttf52 1/1 Running 0 22m kube-system kube-proxy-xfhx2 1/1 Running 0 22m kube-system kube-scheduler-master 1/1 Running 0 23m kube-system nodelocaldns-22gqz 1/1 Running 0 22m kube-system nodelocaldns-bx7nv 1/1 Running 0 22m kube-system nodelocaldns-t97rq 1/1 Running 0 22m kube-system openebs-localpv-provisioner-7974b86588-gg9nb 1/1 Running 1 (2m36s ago) 22m kube-system snapshot-controller-0 1/1 Running 0 18m kubesphere-controls-system default-http-backend-659cc67b6b-j8jl5 1/1 Running 0 12m kubesphere-monitoring-system alertmanager-main-0 2/2 Running 0 3m54s kubesphere-monitoring-system alertmanager-main-1 2/2 Running 0 3m52s kubesphere-monitoring-system alertmanager-main-2 2/2 Running 0 3m51s kubesphere-monitoring-system kube-state-metrics-69f4fbb5d6-khf2c 3/3 Running 0 4m34s kubesphere-monitoring-system node-exporter-57sgh 2/2 Running 0 4m42s kubesphere-monitoring-system node-exporter-k4dph 2/2 Running 0 4m44s kubesphere-monitoring-system node-exporter-lfbkq 2/2 Running 0 4m42s kubesphere-monitoring-system notification-manager-deployment-cdd656fd-nj6s8 2/2 Running 0 56s kubesphere-monitoring-system notification-manager-deployment-cdd656fd-qzvx8 2/2 Running 0 55s kubesphere-monitoring-system notification-manager-operator-7f7c564948-vj89q 2/2 Running 0 103s kubesphere-monitoring-system prometheus-k8s-0 2/2 Running 0 4m23s kubesphere-monitoring-system prometheus-k8s-1 2/2 Running 0 4m21s kubesphere-monitoring-system prometheus-operator-684988fc5c-n26kz 2/2 Running 0 4m53s kubesphere-system ks-apiserver-78bc58d684-76226 0/1 ContainerCreating 0 12m kubesphere-system ks-console-799f77fb7d-w29wf 1/1 Running 0 12m kubesphere-system ks-controller-manager-8569fb495c-b9qwv 0/1 ContainerCreating 0 12m kubesphere-system ks-installer-86ddb55c5b-gwlhh 1/1 Running 0 22m |
可以进入pod容器查看目录
0 1 |
kubectl exec --namespace kubesphere-system ks-installer-86ddb55c5b-gwlhh -it -- /bin/bash |
也可以直接用logs查看日志
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
kubectl logs --namespace kubesphere-system ks-installer-86ddb55c5b-gwlhh -f 前面省略了,最后长这样 PLAY RECAP ********************************************************************* localhost : ok=31 changed=22 unreachable=0 failed=0 skipped=16 rescued=0 ignored=0 Start installing monitoring Start installing multicluster Start installing openpitrix Start installing network ************************************************** Waiting for all tasks to be completed ... ************************************************** Waiting for all tasks to be completed ... task network status is successful (1/4) task openpitrix status is successful (2/4) task multicluster status is successful (3/4) task monitoring status is successful (4/4) ************************************************** Collecting installation results ... |
观察到这两个pod一直起不来
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
kubesphere-system ks-apiserver-78bc58d684-76226 0/1 ContainerCreating 0 13m kubesphere-system ks-controller-manager-8569fb495c-b9qwv 0/1 ContainerCreating 0 13m kubectl describe pod --namespace kubesphere-system ks-apiserver-78bc58d684-76226 Name: ks-apiserver-78bc58d684-76226 Namespace: kubesphere-system Priority: 0 Node: master/192.168.2.206 Start Time: Fri, 07 Apr 2023 13:33:20 +0000 Labels: app=ks-apiserver pod-template-hash=78bc58d684 tier=backend Annotations: <none> Status: Pending IP: IPs: <none> Controlled By: ReplicaSet/ks-apiserver-78bc58d684 Containers: ks-apiserver: Container ID: Image: registry.cn-beijing.aliyuncs.com/kubesphereio/ks-apiserver:v3.3.2 Image ID: Port: 9090/TCP Host Port: 0/TCP Command: ks-apiserver --logtostderr=true State: Waiting Reason: ContainerCreating Ready: False Restart Count: 0 Limits: cpu: 1 memory: 1Gi Requests: cpu: 20m memory: 100Mi Liveness: http-get http://:9090/kapis/version delay=15s timeout=15s period=10s #success=1 #failure=8 Environment: <none> Mounts: /etc/kubesphere/ from kubesphere-config (rw) /etc/kubesphere/ingress-controller from ks-router-config (rw) /etc/localtime from host-time (ro) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-xp572 (ro) Conditions: Type Status Initialized True Ready False ContainersReady False PodScheduled True Volumes: ks-router-config: Type: ConfigMap (a volume populated by a ConfigMap) Name: ks-router-config Optional: false kubesphere-config: Type: ConfigMap (a volume populated by a ConfigMap) Name: kubesphere-config Optional: false host-time: Type: HostPath (bare host directory volume) Path: /etc/localtime HostPathType: kube-api-access-xp572: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: <nil> DownwardAPI: true QoS Class: Burstable Node-Selectors: <none> Tolerations: CriticalAddonsOnly op=Exists node-role.kubernetes.io/master:NoSchedule node.kubernetes.io/not-ready:NoExecute op=Exists for 60s node.kubernetes.io/unreachable:NoExecute op=Exists for 60s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 14m default-scheduler Successfully assigned kubesphere-system/ks-apiserver-78bc58d684-76226 to master Warning FailedMount 7m24s kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[kubesphere-config host-time kube-api-access-xp572 ks-router-config]: timed out waiting for the condition Warning FailedMount 2m51s (x2 over 5m7s) kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[kube-api-access-xp572 ks-router-config kubesphere-config host-time]: timed out waiting for the condition Warning FailedMount 103s (x14 over 14m) kubelet MountVolume.SetUp failed for volume "kubesphere-config" : configmap "kubesphere-config" not found Warning FailedMount 36s (x3 over 11m) kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[ks-router-config kubesphere-config host-time kube-api-access-xp572]: timed out waiting for the condition kubectl describe pod --namespace kubesphere-system ks-controller-manager-8569fb495c-b9qwv Name: ks-controller-manager-8569fb495c-b9qwv Namespace: kubesphere-system Priority: 0 Node: master/192.168.2.206 Start Time: Fri, 07 Apr 2023 13:33:19 +0000 Labels: app=ks-controller-manager pod-template-hash=8569fb495c tier=backend Annotations: <none> Status: Pending IP: IPs: <none> Controlled By: ReplicaSet/ks-controller-manager-8569fb495c Containers: ks-controller-manager: Container ID: Image: registry.cn-beijing.aliyuncs.com/kubesphereio/ks-controller-manager:v3.3.2 Image ID: Ports: 8080/TCP, 8443/TCP Host Ports: 0/TCP, 0/TCP Command: controller-manager --logtostderr=true --leader-elect=true State: Waiting Reason: ContainerCreating Ready: False Restart Count: 0 Limits: cpu: 1 memory: 1000Mi Requests: cpu: 30m memory: 50Mi Environment: <none> Mounts: /etc/kubesphere/ from kubesphere-config (rw) /etc/localtime from host-time (ro) /tmp/k8s-webhook-server/serving-certs from webhook-secret (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-nfk8r (ro) Conditions: Type Status Initialized True Ready False ContainersReady False PodScheduled True Volumes: kubesphere-config: Type: ConfigMap (a volume populated by a ConfigMap) Name: kubesphere-config Optional: false webhook-secret: Type: Secret (a volume populated by a Secret) SecretName: ks-controller-manager-webhook-cert Optional: false host-time: Type: HostPath (bare host directory volume) Path: /etc/localtime HostPathType: kube-api-access-nfk8r: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: <nil> DownwardAPI: true QoS Class: Burstable Node-Selectors: <none> Tolerations: CriticalAddonsOnly op=Exists node-role.kubernetes.io/master:NoSchedule node.kubernetes.io/not-ready:NoExecute op=Exists for 60s node.kubernetes.io/unreachable:NoExecute op=Exists for 60s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 14m default-scheduler Successfully assigned kubesphere-system/ks-controller-manager-8569fb495c-b9qwv to master Warning FailedMount 14m kubelet MountVolume.SetUp failed for volume "webhook-secret" : failed to sync secret cache: timed out waiting for the condition Warning FailedMount 7m43s (x3 over 12m) kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[kubesphere-config webhook-secret host-time kube-api-access-nfk8r]: timed out waiting for the condition Warning FailedMount 3m12s kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[kube-api-access-nfk8r kubesphere-config webhook-secret host-time]: timed out waiting for the condition Warning FailedMount 2m (x14 over 14m) kubelet MountVolume.SetUp failed for volume "kubesphere-config" : configmap "kubesphere-config" not found Warning FailedMount 55s (x2 over 5m28s) kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[host-time kube-api-access-nfk8r kubesphere-config webhook-secret]: timed out waiting for the condition |
都是源于configmap kubesphere-config不存在
多等了一会发现第二个pod ks-controller-manager-8569fb495c-b9qwv自己成功了,可能有降级?(来自20230701的更新:只是单纯的慢,实际是monitor还没装完,所以不动它也能自己好)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
k8s3@k8s3:~$ kubectl describe pod --namespace kubesphere-system ks-controller-manager-8569fb495c-b9qwv Name: ks-controller-manager-8569fb495c-b9qwv Namespace: kubesphere-system Priority: 0 Node: master/192.168.2.206 Start Time: Fri, 07 Apr 2023 13:33:19 +0000 Labels: app=ks-controller-manager pod-template-hash=8569fb495c tier=backend Annotations: cni.projectcalico.org/containerID: 23d0c4603543c2e6bb05897f1801e37dc9475985d463721d3728553e85d4011c cni.projectcalico.org/podIP: 10.233.70.2/32 cni.projectcalico.org/podIPs: 10.233.70.2/32 Status: Running IP: 10.233.70.2 IPs: IP: 10.233.70.2 Controlled By: ReplicaSet/ks-controller-manager-8569fb495c Containers: ks-controller-manager: Container ID: docker://37abb2be10787e5ca931ad515edf70099aed3d5516ec24772aaff0903f915c74 Image: registry.cn-beijing.aliyuncs.com/kubesphereio/ks-controller-manager:v3.3.2 Image ID: docker-pullable://registry.cn-beijing.aliyuncs.com/kubesphereio/ks-controller-manager@sha256:dce79d8513fa19105516e312d5b3b9828171d660a78aa7ebd866e42f6a51db25 Ports: 8080/TCP, 8443/TCP Host Ports: 0/TCP, 0/TCP Command: controller-manager --logtostderr=true --leader-elect=true State: Running Started: Fri, 07 Apr 2023 13:48:38 +0000 Ready: True Restart Count: 0 Limits: cpu: 1 memory: 1000Mi Requests: cpu: 30m memory: 50Mi Environment: <none> Mounts: /etc/kubesphere/ from kubesphere-config (rw) /etc/localtime from host-time (ro) /tmp/k8s-webhook-server/serving-certs from webhook-secret (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-nfk8r (ro) Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: kubesphere-config: Type: ConfigMap (a volume populated by a ConfigMap) Name: kubesphere-config Optional: false webhook-secret: Type: Secret (a volume populated by a Secret) SecretName: ks-controller-manager-webhook-cert Optional: false host-time: Type: HostPath (bare host directory volume) Path: /etc/localtime HostPathType: kube-api-access-nfk8r: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: <nil> DownwardAPI: true QoS Class: Burstable Node-Selectors: <none> Tolerations: CriticalAddonsOnly op=Exists node-role.kubernetes.io/master:NoSchedule node.kubernetes.io/not-ready:NoExecute op=Exists for 60s node.kubernetes.io/unreachable:NoExecute op=Exists for 60s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 17m default-scheduler Successfully assigned kubesphere-system/ks-controller-manager-8569fb495c-b9qwv to master Warning FailedMount 17m kubelet MountVolume.SetUp failed for volume "webhook-secret" : failed to sync secret cache: timed out waiting for the condition Warning FailedMount 10m (x3 over 15m) kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[kubesphere-config webhook-secret host-time kube-api-access-nfk8r]: timed out waiting for the condition Warning FailedMount 6m25s kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[kube-api-access-nfk8r kubesphere-config webhook-secret host-time]: timed out waiting for the condition Warning FailedMount 5m13s (x14 over 17m) kubelet MountVolume.SetUp failed for volume "kubesphere-config" : configmap "kubesphere-config" not found Warning FailedMount 4m8s (x2 over 8m41s) kubelet Unable to attach or mount volumes: unmounted volumes=[kubesphere-config], unattached volumes=[host-time kube-api-access-nfk8r kubesphere-config webhook-secret]: timed out waiting for the condition Normal Pulling 2m59s kubelet Pulling image "registry.cn-beijing.aliyuncs.com/kubesphereio/ks-controller-manager:v3.3.2" Normal Pulled 2m17s kubelet Successfully pulled image "registry.cn-beijing.aliyuncs.com/kubesphereio/ks-controller-manager:v3.3.2" in 42.28238507s Normal Created 2m16s kubelet Created container ks-controller-manager Normal Started 2m14s kubelet Started container ks-controller-manager |
尝试手动修改kubesphere-config 里的jwtToken
kubectl get cm kubesphere-config -n kubesphere-system -o yaml
删除pod ks-apiserver后不再报错
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
##################################################### ### Welcome to KubeSphere! ### ##################################################### Console: http://192.168.2.206:30880 Account: admin Password: 123456 NOTES: 1. After you log into the console, please check the monitoring status of service components in "Cluster Management". If any service is not ready, please wait patiently until all components are up and running. 2. Please change the default password after login. ##################################################### https://kubesphere.io 2023-04-07 14:27:35 ##################################################### kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f |
参考
https://kubesphere.io/zh/docs/v3.3/installing-on-linux/introduction/multioverview/
https://github.com/kubesphere/kubesphere/issues/4729
http://www.minio.org.cn/docs/minio/kubernetes/upstream/
https://docs.ceph.com/en/quincy/cephfs/index.html
0 Comments