CentOS8安装Kubernetes 1.18

防伪码:无边落木萧萧下,不尽长江滚滚来。

我们很高兴地宣布Kubernetes 1.18的发布,这是我们2020年的第一个版本!Kubernetes 1.18包含38项功能增强:15个稳定版,11个beta版,12个alpha版。

Kubernetes 1.18是一个“代表精确度与完成度”的版本。为了更好的用户体验,Kubernetes 1.18在Beta版和稳定版功能改进方面做了大量工作。同时努力增加了一些新功能开发和令人兴奋的新特性,进一步提高用户体验。1.18版本在alpha、beta和稳定版本上几乎有差不多的增强,这表明社区在提高Kubernetes的可靠性,以及继续扩展其现有功能方面做出了巨大努力。

核心主题

Kubernetes拓扑管理器升级到Beta版-对齐!

作为Kubernetes在1.18版中的beta特性,拓扑管理器特性支持CPU和其他设备(如SR-IOV VFs)实现NUMA对齐,允许工作负载运行在优化环境中降低延迟。在引入拓扑管理器之前,CPU和设备管理器只能各自独立做出资源分配决策,导致在multi-socket 系统上出现不希望的分配,从而导致关键应用性能下降。

Serverside Apply迈向Beta 2

Server-side Apply在1.16中升级为Beta版,现在在1.18中引入了第二个Beta版。该新版本将跟踪和管理所有新Kubernetes对象的字段更改,确保用户及时了解哪些资源做了变更,以及何时更改的。

IngressClass扩展Ingress,并替换非推荐注解

在Kubernetes 1.18中,有两项重要的Ingress添加:新的pathType字段和新的IngressClass资源。pathType字段允许指定如何匹配路径。除了默认的特定实现的类型之外,还新增了Exact和Prefix两种路径类型。

IngressClass资源用于描述Kubernetes集群中的一种Ingress。通过在ingress上使用新的ingressClassName字段,ingress可以指定与其相关联的类。这一全新资源和字段代替了不被推荐的kubernets .io/ ings .class注解。

SIG-CLI引入kubectl调试

在相当长的一段时间内,SIG-CLI一直在讨论是否需要调试功能。随着短生命周期容器的开发,如何使用构建在kubectl exec上的工具来支持开发人员变得显而易见。kubectl调试命令的添加(alpha版)允许开发人员轻松调试集群中的pod,这一增加是无价的。这个命令允许创建一个即席容器,它运行在待检查的pod旁边,同时附带控制台以进行交互式故障排查。

为Kubernetes推出Windows CSI支持的Alpha版

随着Kubernetes 1.18的发布,Windows的CSI代理的alpha版本也即将发布。CSI代理允许无授权(预先批准的)容器在Windows上执行授权存储操作。利用CSI代理可以在Windows中支持CSI驱动。

其他更新

升级到稳定版:

基于污点的驱逐

kubectl diff

CSI Block存储支持

API Server试运行

在CSI calls中传递Pod信息

支持Out-of-Tree vSphere Cloud Provider

支持针对Windows工作负载的GMSA

跳过不可附加的CSI存储卷

PVC cloning(克隆)

将kubectl包代码移到staging

用于Windows的RunAsUserName

AppProtocol for Services and Endpoints

扩展Hugepage功能

client-go签名重构,实现标准化选项和上下文处理

节点本地DNS缓存

重要变更

EndpointSlice API

将kubectl包代码移到staging

CertificateSigningRequest API

扩展Hugepage特性

client-go签名重构,实现标准化选项和上下文处理

发布徽标

PV2NG`3KXL04I%8)J_JR43K.png


用户亮点

爱立信正在使用Kubernetes和其他云原生技术来交付有强大表现的5G网络,CI/CD实现成功降低高达90%。

Zendesk正在使用Kubernetes来运行大约70%的现有应用。所有新应用也都是运行在Kubernetes上,使其应用开发更加节省时间,获得更大的灵活性和快速。

LifeMiles公司自从迁移到Kubernetes,基础设施支出减少了50%,现有资源能力增加一倍。

生态系统更新

CNCF公布的年度调查结果显示,生产环境中使用Kubernetes的数量正在飙升。调查发现,78%的受访者在生产中使用Kubernetes,而去年这一比例为58%。

由CNCF主办的“Kubernetes概论”课程,报名人数超过10万人。


环境说明:

#操作系统:centos8

#docker版本:19.03.8

#kubernetes版本:v1.18

#网络插件:calico

#kube-proxy网络转发: ipvs

#kubernetes源:使用阿里云源

#service-cidr:10.10.0.0/16

#pod-network-cidr:10.122.0.0/16 

1、系统准备

查看系统版本

[root@yangwen ~]# cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core) 
[root@yangwen ~]# uname -r
4.18.0-147.el8.x86_64

配置网络

[root@yangwen ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=660cffeb-fd7a-4552-aaea-972ee0559e5c
DEVICE=ens33
ONBOOT=yes

添加阿里源

[root@yangwen ~]# rm -rfv /etc/yum.repos.d/*
已删除'/etc/yum.repos.d/CentOS-AppStream.repo'
已删除'/etc/yum.repos.d/CentOS-Base.repo'
已删除'/etc/yum.repos.d/CentOS-centosplus.repo'
已删除'/etc/yum.repos.d/CentOS-CR.repo'
已删除'/etc/yum.repos.d/CentOS-Debuginfo.repo'
已删除'/etc/yum.repos.d/CentOS-Extras.repo'
已删除'/etc/yum.repos.d/CentOS-fasttrack.repo'
已删除'/etc/yum.repos.d/CentOS-HA.repo'
已删除'/etc/yum.repos.d/CentOS-Media.repo'
已删除'/etc/yum.repos.d/CentOS-PowerTools.repo'
已删除'/etc/yum.repos.d/CentOS-Sources.repo'
已删除'/etc/yum.repos.d/CentOS-Vault.repo'
[root@yangwen ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2595  100  2595    0     0   7587      0 --:--:-- --:--:-- --:--:-

配置主机名

[root@yangwen ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.40.131 yangwen

关闭swap,注释swap分区

[root@yangwen ~]# swapoff -a
[root@yangwen ~]# cat /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Fri Apr 17 04:23:58 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=d49ac8b0-9833-4747-9a80-587d85f15a80 /boot                   ext4    defaults        1 2
#/dev/mapper/cl-swap     swap                    swap    defaults

配置内核参数,将桥接的IPv4流量传递到iptables的链

[root@yangwen ~]# cat > /etc/sysctl.d/k8s.conf <<EOF
> 
> net.bridge.bridge-nf-call-ip6tables = 1
> 
> net.bridge.bridge-nf-call-iptables = 1
> 
> EOF
[root@yangwen ~]# /usr/sbin/sysctl --system

2、安装常用包

[root@yangwen ~]# yum install vim bash-completion net-tools gcc -y

3、使用aliyun源安装docker-ce

[root@yangwen ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@yangwen ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

添加仓库自:https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

[root@yangwen ~]# yum -y install docker-ce

安装docker-ce如果出现以下错

N`LG}@ZJ]AG{NCR1D_TF`DF.jpg

解决方法

[root@yangwen ~]# wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
[root@yangwen ~]# yum install containerd.io-1.2.6-3.3.el7.x86_64.rpm

然后再安装docker-ce即可成功

[root@yangwen ~]# yum -y install docker-ce

添加aliyundocker仓库加速器

[root@yangwen ~]# mkdir -p /etc/docker
[root@yangwen ~]# tee /etc/docker/daemon.json <<-'EOF'
> 
> {
> 
>   "registry-mirrors": ["https://fl791z1h.mirror.aliyuncs.com"]
> 
> }
> 
> EOF
{
  "registry-mirrors": ["https://fl791z1h.mirror.aliyuncs.com"]
}
[root@yangwen ~]# systemctl daemon-reload
[root@yangwen ~]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@yangwen ~]# systemctl restart docker

注:如果有报错,yum update一下然后重新安装docker即可

4、安装kubectl、kubelet、kubeadm

添加阿里kubernetes源

[root@yangwen ~]# cat <<EOF > /etc/yum.repos.d/kubernetes.repo
> 
> [kubernetes]
> 
> name=Kubernetes
> 
> baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
> 
> enabled=1
> 
> gpgcheck=1
> 
> repo_gpgcheck=1
> 
> gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
> 
> EOF

安装

[root@yangwen ~]# yum install kubectl kubelet kubeadm

一直输入y,回车

[root@yangwen ~]# systemctl enable kubelet
Created symlink /etc/systemd/system/multi-user.target.wants/kubelet.service → /usr/lib/systemd/system/kubelet.service.

5、初始化k8s集群

[root@yangwen ~]#kubeadm init --apiserver-advertise-address=0.0.0.0 \
--apiserver-cert-extra-sans=127.0.0.1 \
--image-repository=registry.aliyuncs.com/google_containers \
--ignore-preflight-errors=all \
--kubernetes-version=v1.18.0 \
--service-cidr=10.10.0.0/16 \
--pod-network-cidr=10.122.0.0/16

POD的网段为: 10.122.0.0/16, api server地址就是master本机IP。

这一步很关键,由于kubeadm 默认从官网k8s.grc.io下载所需镜像,国内无法访问,因此需要通过–image-repository指定阿里云镜像仓库地址。

集群初始化成功后返回如下信息:


W0408 09:36:36.121603   14098 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.18.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'
[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
[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 [master01.paas.com kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.10.0.1 192.168.122.21]
[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] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [master01.paas.com localhost] and IPs [192.168.122.21 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [master01.paas.com localhost] and IPs [192.168.122.21 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[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
[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"
W0408 09:36:43.343191   14098 manifests.go:225] the default kube-apiserver authorization-mode is "Node,RBAC"; using "Node,RBAC"
[control-plane] Creating static Pod manifest for "kube-scheduler"
W0408 09:36:43.344303   14098 manifests.go:225] the default kube-apiserver authorization-mode is "Node,RBAC"; using "Node,RBAC"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[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.002541 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.18" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node master01.paas.com as control-plane by adding the label "node-role.kubernetes.io/master=''"
[mark-control-plane] Marking the node master01.paas.com as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: v2r5a4.veazy2xhzetpktfz
[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
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/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.122.21:6443 --token v2r5a4.veazy2xhzetpktfz \
    --discovery-token-ca-cert-hash sha256:daded8514c8350f7c238204979039ff9884d5b595ca950ba8bbce80724fd65d4

记录生成的最后部分内容,此内容需要在其它节点加入Kubernetes集群时执行。

根据提示创建kubectl

[root@yangwen ~]# mkdir -p $HOME/.kube
[root@yangwen ~]#sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@yangwen ~]#sudo chown $(id -u):$(id -g) $HOME/.kube/config

执行下面命令,使kubectl可以自动补充

[root@yangwen ~]#source <(kubectl completion bash)

查看节点,pod

6YZ}%3{POM7DB({DUTHR2TR.png

[root@yangwen ~]# kubectl get node
NAME      STATUS   ROLES    AGE    VERSION
yangwen   Ready    master   110m   v1.18.2
[root@yangwen ~]# kubectl get pod --all-namespaces

T9`58N]_YE6YC9U63$@C`BW.png

node节点为NotReady,因为corednspod没有启动,缺少网络pod

6、安装calico网络

[root@yangwen ~]# kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
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/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/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
[root@yangwen ~]# kubectl get pod --all-namespaces

T9`58N]_YE6YC9U63$@C`BW.png

此时集群状态正常

7、安装kubernetes-dashboard

官方部署dashboard的服务没使用nodeport,将yaml文件下载到本地,在service里添加nodeport

[root@yangwen ~]#wget  https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc7/aio/deploy/recommended.yaml
[root@yangwen ~]# vim recommended.yaml
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
spec:
  type: NodePort
  ports:
    - port: 443
      targetPort: 8443
      nodePort: 30000
  selector:
    k8s-app: kubernetes-dashboard
[root@yangwen ~]#kubectl create -f recommended.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created

查看pod,service


NAME                                        READY   STATUS    RESTARTS   AGE
dashboard-metrics-scraper-dc6947fbf-869kf   1/1     Running   0          37s
kubernetes-dashboard-5d4dc8b976-sdxxt       1/1     Running   0          37s
[root@yangwen ~]# kubectl get svc -n kubernetes-dashboard
NAME                        TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)         AGE
dashboard-metrics-scraper   ClusterIP   10.10.25.162     <none>        8000/TCP        44s
kubernetes-dashboard        NodePort    10.10.150.164   <none>        443:30000/TCP   44s

通过页面访问,推荐使用firefox浏览器

1)U0YPLGIS%N`)S4D(PU4[N.png

使用token进行登录,

创建 token

[root@yangwen ~]# kubectl create sa dashboard-admin -n kube-system
serviceaccount/dashboard-admin created

授权token 访问权限

[root@yangwen ~]# kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
clusterrolebinding.rbac.authorization.k8s.io/dashboard-admin created

获取token 

[root@yangwen ~]# ADMIN_SECRET=$(kubectl get secrets -n kube-system | grep dashboard-admin | awk '{print $1}')

获取dashboard.kubeconfig 使用token值

[root@yangwen ~]# DASHBOARD_LOGIN_TOKEN=$(kubectl describe secret -n kube-system ${ADMIN_SECRET} | grep -E '^token' | awk '{print $2}')
[root@yangwen ~]# echo ${DASHBOARD_LOGIN_TOKEN}
eyJhbGciOiJSUzI1NiIsImtpZCI6ImZRZWdIWENkZUUyZHlzX2duNHhxUjNmVFRIY3hqdlJyUzhnZ050TFY0cW8ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tMmZrd3ciLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZmM5NzQyZDktMTdhZC00ZWI1LWIxYTItZTBhZmFhNmU5OWFlIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.hrvBZTSaxVEQY3EQb_n_CerWyz22s3OKwfceh5YxIGTNO5hnw9AWSqmY7hjksrqZ82nsRUxVZeSYQ-G1P0UQs3TEKzUzP5NUppcZ56nW0hu7MHiiQ10uzNaAnhqTpdylKPiy6XgZGu4QVITiZwhUxf3t2dMeYfw3YdIfo5xJR_4OPhQuENlhBeq_5OxBHz_zBhfUazknKp4x1abfTONvWfqgaWBXCKD8EdCn2q4ydfkJR6e4UjCM-u3SAxUI1Cir15WfJOxW9GEXPtVCtlb7HiVQyJJ-McuhQRcMOnOF36tiFmb4vzhWUOsXxdHrIHgjz72x674bKTBn7PyNgb2XwA

L@$$)OYSA[{W9N~K{}KI[W0.png

注意事项:

#kubeadm token 默认时间是24 小时,过期记得从新生成token 然后加入节点
# 查看token
kubeadm   token list
# 创建token
kubeadm   token create
#忘记初始master节点时的node节点加入集群命令怎么办
# 简单方法
kubeadm token create --print-join-command
# 第二种方法
token=$(kubeadm token generate)
kubeadm token create $token --print-join-command --ttl=0
# 接下来就可以部署监控,应用等。


猜你喜欢

转载自blog.51cto.com/yw666/2489128