CentOS 7.9基于kubeadm部署kubernetes v1.25.9

小柒博客 Kubernetes评论8721字数 18827阅读62分45秒阅读模式

一、Kubernetes简介

Kubernetes(简称K8S)是开源的容器集群管理系统,可以实现容器集群的自动化部署、自动扩缩容、维护等功能。它既是一款容器编排工具,也是全新的基于容器技术的分布式架构领先方案。在Docker技术的基础上,为容器化的应用提供部署运行、资源调度、服务发现和动态伸缩等功能,提高了大规模容器集群管理的便捷性。

K8S集群中有管理节点与工作节点两种类型。管理节点主要负责K8S集群管理,集群中各节点间的信息交互、任务调度,还负责容器、Pod、NameSpaces、PV等生命周期的管理。工作节点主要为容器和Pod提供计算资源,Pod及容器全部运行在工作节点上,工作节点通过kubelet服务与管理节点通信以管理容器的生命周期,并与集群其他节点进行通信。

二、K8s集群部署环境准备

1环境架构

IP

主机名

操作系统

Kubelet版本

用途

192.168.11.199

k8s-master

CentOS 7.9.2009

V1.25.9

管理节点

192.168.11.198

k8s-node2

CentOS 7.9.2009

V1.25.9

工作节点

192.168.11.197

k8s-node1

CentOS 7.9.2009

V1.25.9

工作节点

注:以下操作所有节点需要执行

2配置主机名

# Master

[root@localhost ~]# hostnamectl set-hostname k8s-master --static

# Node1

[root@localhost ~]# hostnamectl set-hostname k8s-node1 --static

# Node2

[root@localhost ~]# hostnamectl set-hostname k8s-node2 --static

[root@localhost ~]# su -

[root@k8s-master ~]# cat >>/etc/hosts <<EOF

192.168.11.199 k8s-master

192.168.11.198 k8s-node2

192.168.11.197 k8s-node1

EOF

3关闭防火墙和selinux

[root@k8s-master ~]# systemctl stop firewalld.service

[root@k8s-master ~]# systemctl disable firewalld.service

[root@k8s-master ~]# setenforce 0

[root@k8s-master ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

4关闭swap分区

[root@k8s-master ~]# swapoff -a

[root@k8s-master ~]# sed -i '/swap/s/^/#/g' /etc/fstab

5配置内核参数和优化

[root@k8s-master ~]# cat > /etc/sysctl.d/k8s.conf <<EOF

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

net.ipv4.ip_forward = 1

EOF

[root@k8s-master ~]# sysctl --system

6安装ipset、ipvsadm

[root@k8s-master ~]# yum -y install ipvsadm ipset

[root@k8s-master ~]# cat >/etc/modules-load.d/ipvs.conf <<EOF

# Load IPVS at boot

ip_vs

ip_vs_rr

ip_vs_wrr

ip_vs_sh

nf_conntrack

nf_conntrack_ipv4

EOF

[root@k8s-master ~]# systemctl enable --now systemd-modules-load.service

# 确认内核模块加载成功

[root@k8s-master ~]# lsmod |egrep "ip_vs|nf_conntrack_ipv4"

nf_conntrack_ipv4         15053 0

nf_defrag_ipv4               12729 1 nf_conntrack_ipv4

ip_vs_sh                        12688 0

ip_vs_wrr                       12697 0

ip_vs_rr                         12600 0

ip_vs                           145458 6 ip_vs_rr,ip_vs_sh,ip_vs_wrr

nf_conntrack              139264 2 ip_vs,nf_conntrack_ipv4

libcrc32c                      12644 3 xfs,ip_vs,nf_conntrack

7安装containerd

1)安装依赖软件包

[root@k8s-master ~]# yum -y install yum-utils device-mapper-persistent-data lvm2

2)添加阿里Docker源

[root@k8s-master ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3)添加overlay和netfilter模块

[root@k8s-master ~]# cat >>/etc/modules-load.d/containerd.conf <<EOF

overlay

br_netfilter

EOF

[root@k8s-master ~]# modprobe overlay

[root@k8s-master ~]# modprobe br_netfilter

4)安装Containerd,这里安装最新版本

[root@k8s-master ~]# yum -y install containerd.io

5)创建Containerd的配置文件

[root@k8s-master ~]# mkdir -p /etc/containerd

[root@k8s-master ~]# containerd config default > /etc/containerd/config.toml

[root@k8s-master ~]# sed -i '/SystemdCgroup/s/false/true/g' /etc/containerd/config.toml

[root@k8s-master ~]# sed -i '/sandbox_image/s/registry.k8s.io/registry.aliyuncs.com\/google_containers/g' /etc/containerd/config.toml

6)启动containerd

[root@k8s-master ~]# systemctl enable containerd

[root@k8s-master ~]# systemctl start containerd

三、安装kubectl、kubelet、kubeadm

1添加阿里kubernetes源

[root@k8s-master ~]# cat >/etc/yum.repos.d/kubernetes.repo <<EOF

[kubernetes]

name=Kubernetes

baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/

enabled=1

gpgcheck=0

repo_gpgcheck=0

gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

EOF

2安装kubectl、kubelet、kubeadm

1)查看所有的可用版本

[root@k8s-master ~]# yum list kubelet --showduplicates |grep 1.25

kubelet.x86_64     1.25.0-0    kubernetes

kubelet.x86_64     1.25.1-0    kubernetes

kubelet.x86_64     1.25.2-0    kubernetes

kubelet.x86_64     1.25.3-0    kubernetes

kubelet.x86_64     1.25.4-0    kubernetes

kubelet.x86_64     1.25.5-0    kubernetes

kubelet.x86_64     1.25.6-0    kubernetes

kubelet.x86_64     1.25.7-0    kubernetes

kubelet.x86_64     1.25.8-0    kubernetes

kubelet.x86_64     1.25.9-0    kubernetes

2)这里安装当前最新版本1.25.9

[root@k8s-master ~]# yum -y install kubectl-1.25.9 kubelet-1.25.9 kubeadm-1.25.9

3)启动kubelet

[root@k8s-master ~]# systemctl enable kubelet

[root@k8s-master ~]# systemctl start kubelet

四、部署Kubernetes Master

1初始化Kubernetes集群

1)查看k8s v1.25.9初始化所需要的镜像

[root@k8s-master ~]# kubeadm config images list --kubernetes-version=v1.25.9

registry.k8s.io/kube-apiserver:v1.25.9

registry.k8s.io/kube-controller-manager:v1.25.9

registry.k8s.io/kube-scheduler:v1.25.9

registry.k8s.io/kube-proxy:v1.25.9

registry.k8s.io/pause:3.8

registry.k8s.io/etcd:3.5.6-0

registry.k8s.io/coredns/coredns:v1.9.3

2)初始化

[root@k8s-master ~]# kubeadm init --kubernetes-version=1.25.9 \

--apiserver-advertise-address=192.168.11.199 \

--image-repository registry.aliyuncs.com/google_containers \

--pod-network-cidr=172.16.0.0/16

注:pod的网段为: 172.16.0.0/16,api server地址为Master本机IP,网段可以自定义,不冲突即可。

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

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

[init] Using Kubernetes version: v1.25.9

[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 [k8s-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.11.199]

[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 [k8s-master localhost] and IPs [192.168.11.199 127.0.0.1 ::1]

[certs] Generating "etcd/peer" certificate and key

[certs] etcd/peer serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.11.199 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

[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"

[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 8.502370 seconds

[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace

[kubelet] Creating a ConfigMap "kubelet-config" 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 k8s-master as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]

[mark-control-plane] Marking the node k8s-master as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]

[bootstrap-token] Using token: e5x76u.msfiey970bj1noi0

[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/

Then you can join any number of worker nodes by running the following on each as root:

 

kubeadm join 192.168.11.199:6443 --token e5x76u.msfiey970bj1noi0 \

    --discovery-token-ca-cert-hash sha256:83c5921ea461c654050e30786814f9d63c12a604e889c1622902dd3b1f77867a

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

2根据提示创建kubectl

[root@k8s-master ~]# mkdir -p $HOME/.kube

[root@k8s-master ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

[root@k8s-master ~]# sudo chown $(id -u):$(id -g) $HOME/.kube/config

[root@k8s-master ~]# export KUBECONFIG=/etc/kubernetes/admin.conf

3查看node节点和pod

[root@k8s-master ~]# kubectl get node

NAME         STATUS     ROLES            AGE     VERSION

k8s-master  NotReady   control-plane   2m6s    v1.25.9

[root@k8s-master ~]# kubectl get pod -A

NAMESPACE NAME                              READY       STATUS     RESTARTS   AGE

kube-system coredns-c676cc86f-fxrtx    0/1             Pending     0                   2m4s

kube-system coredns-c676cc86f-pdcnp 0/1             Pending      0                  2m4s

kube-system etcd-k8s-master                1/1             Running     0                  2m19s

kube-system kube-apiserver-k8s-master 1/1            Running    0                   2m18s

kube-system kube-controller-manager-k8s-master   1/1     Running   0         2m18s

kube-system kube-proxy-g688t              1/1             Running    0                   2m4s

kube-system kube-scheduler-k8s-master 1/1            Running   0                   2m19s

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

4安装Pod网络插件calico(CNI)

[root@k8s-master ~]# kubectl apply -f https://docs.tigera.io/archive/v3.24/manifests/calico.yaml

poddisruptionbudget.policy/calico-kube-controllers created

serviceaccount/calico-kube-controllers created

serviceaccount/calico-node created

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

clusterrole.rbac.authorization.k8s.io/calico-node created

clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created

clusterrolebinding.rbac.authorization.k8s.io/calico-node created

daemonset.apps/calico-node created

deployment.apps/calico-kube-controllers created

5再次查看pod和node

[root@k8s-master ~]# kubectl get pod -A

NAMESPACE NAME                                                       READY STATUS   RESTARTS   AGE

kube-system calico-kube-controllers-798cc86c47-tqsxg 1/1       Running   0                  85s

kube-system calico-node-n8p6f                                      1/1       Running   0                  85s

kube-system coredns-c676cc86f-fxrtx                             1/1      Running   0                  3m55s

kube-system coredns-c676cc86f-pdcnp                          1/1       Running   0                  3m55s

kube-system etcd-k8s-master                                          1/1      Running   0                  4m10s

kube-system kube-apiserver-k8s-master                          1/1      Running   0                  4m9s

kube-system kube-controller-manager-k8s-master           1/1      Running   0                  4m9s

kube-system kube-proxy-g688t                                        1/1       Running   0                 3m55s

kube-system kube-scheduler-k8s-master                         1/1       Running   0                 4m10s

[root@k8s-master ~]# kubectl get node

NAME         STATUS    ROLES             AGE       VERSION

k8s-master  Ready       control-plane    4m26s    v1.25.9

6从节点加入Kubernetes集群

[root@k8s-node1 ~]# kubeadm join 192.168.11.199:6443 --token e5x76u.msfiey970bj1noi0 \

    --discovery-token-ca-cert-hash sha256:83c5921ea461c654050e30786814f9d63c12a604e889c1622902dd3b1f77867a

[root@k8s-node2 ~]# kubeadm join 192.168.11.199:6443 --token e5x76u.msfiey970bj1noi0 \

    --discovery-token-ca-cert-hash sha256:83c5921ea461c654050e30786814f9d63c12a604e889c1622902dd3b1f77867a

7再次查看Node

[root@k8s-master ~]# kubectl get nodes

NAME          STATUS    ROLES             AGE     VERSION

k8s-master   Ready       control-plane    10m     v1.25.9

k8s-node1    Ready       <none>               3m     v1.25.9

k8s-node2    Ready       <none>               2m     v1.25.9

8kubectl命令补全功能

[root@k8s-master ~]# yum -y install bash-completion

[root@k8s-master ~]# echo "source <(kubectl completion bash)" >> /etc/profile

[root@k8s-master ~]# source /etc/profile

五、安装kubernetes-dashboard

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

1下载配置文件

[root@k8s-master ~]# wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

2修改配置文件

[root@k8s-master ~]# 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@k8s-master ~]# kubectl apply -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

3查看pod和service

[root@k8s-master ~]# kubectl get pod,svc -n kubernetes-dashboard

NAME                                                                     READY     STATUS   RESTARTS   AGE

pod/dashboard-metrics-scraper-64bcc67c9c-dgtlp 1/1          Running   0                  29s

pod/kubernetes-dashboard-5c8bd6b59-tt6mp       1/1          Running   0                  29s

NAME                                             TYPE       CLUSTER-IP      EXTERNAL-IP PORT(S)    AGE

service/dashboard-metrics-scraper ClusterIP 10.105.75.228   <none>            8000/TCP 29s

service/kubernetes-dashboard        NodePort 10.104.155.192 <none>            443:30000/TCP   29s

4访问Dashboard页面

# 浏览器输入https://192.168.11.199:30000/,如下图所示

CentOS 7.9基于kubeadm部署kubernetes v1.25.9

5创建用户

[root@k8s-master ~]# vim dashboard-admin.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin
  namespace: kubernetes-dashboard

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin
  namespace: kubernetes-dashboard  

---
apiVersion: v1
kind: Secret
metadata:
  name: kubernetes-dashboard-admin
  namespace: kubernetes-dashboard
  annotations:
    kubernetes.io/service-account.name: "admin"
type: kubernetes.io/service-account-token

[root@k8s-master ~]# kubectl apply -f dashboard-admin.yaml

serviceaccount/admin created

clusterrolebinding.rbac.authorization.k8s.io/admin created

secret/kubernetes-dashboard-admin created

6创建Token

[root@k8s-master ~]# kubectl -n kubernetes-dashboard create token admin

eyJhbGciOiJSUzI1NiIsImtpZCI6ImJTVzBPUmVSQWRWVEQ3bndaU2Y5YjBfTURmZlJhLUhRYURHZldNVGs2UW8ifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjgxOTgwMTIyLCJpYXQiOjE2ODE5NzY1MjIsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJhZG1pbiIsInVpZCI6IjRmZGU1YTRiLWYzNTktNDJjYS05NDdhLTM4NmYwMmM1YWEwYiJ9fSwibmJmIjoxNjgxOTc2NTIyLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4ifQ.jLMF6ToWJhUUTXdIFIynywTWlvdU-wzOfWjyGYW5KQUN7kvhLjaQu_FRziKQWwNYLq_dWF1xrc0bp1a5c3ghAzUSlIa4VPi1Mg8LJS1Xl7vCRiK1sSuQKvP1oNImlvAw9oTrLu5PlCpPGzkkCu6UVfQBGdpWN8c2cRPk0yaS9eebDpspWQoEgypgLZovJMaxApzQvTJGN9aQpb6LaVRWQl7mCVBIwnpwGieeD0z7lRL7Ny_ACMyB6bZ3on4bp5p-x2sBjbkl4XHOb1QHFBKfP7CO7cw4pTdybMDqM7ABLa7N3npUE4U7AEbA7lPKgmPTq2gf72k1mgYVls6CgT2lrg

7获取Token

[root@k8s-master ~]# Token=$(kubectl -n kubernetes-dashboard get secret |awk '/kubernetes-dashboard-admin/ {print $1}')

[root@k8s-master ~]# kubectl describe secrets -n kubernetes-dashboard ${Token} |grep token |awk 'NR==NF {print $2}'

eyJhbGciOiJSUzI1NiIsImtpZCI6ImJTVzBPUmVSQWRWVEQ3bndaU2Y5YjBfTURmZlJhLUhRYURHZldNVGs2UW8ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlcm5ldGVzLWRhc2hib2FyZC1hZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJhZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjRmZGU1YTRiLWYzNTktNDJjYS05NDdhLTM4NmYwMmM1YWEwYiIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlcm5ldGVzLWRhc2hib2FyZDphZG1pbiJ9.cVdB55seX4iybGApihtt_tzbKg_Ia08WIjvlVEnaUdzJrhEq71aEW6Chi1O7rfqyxb_6KgI3dkLULMrQVm70pqdaPKaeYjj2k9vi7hMguMFWGGcKRDu09Y6iaP273MyGCj9Jt0pkKIqTcp4HWMVZk1ORbRvWjNiliWvzyJNQyJMcUF2o9w_Q_fhAgIdHPv7E0YfVuhj3ppCjKJBaFW9VNe1D5ezT128WE3oK5WgMSI9riI_8dABHd3EcVO7KkbtvmoaexRsw_okmA48Iw6ldtW2eUL9JkfNVoVCOp6aEKGfKGobaGlizj-FBAojlaYYymUDtZ0JDFrje1V3MLRiPlw

8使用Token登录Dashboard


注:登录后如果没有namespace可选,并且提示找不到资源,那么就是权限不足问题导致,可通过以下命令授权

[root@k8s-master ~]# kubectl create clusterrolebinding serviceaccount-cluster-admin --clusterrole=cluster-admin --user=system:serviceaccount:kubernetes-dashboard:kubernetes-dashboard

若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!

继续阅读
历史上的今天
4月
21
Wechat
微信扫一扫,加我!
weinxin
微信公众号
微信扫一扫,关注我!
weinxin
小柒博客
  • 本文由 小柒博客 发表于 2023年4月21日11:23:16
  • 声明:本站所有文章,如无特殊说明或标注,本站文章均为原创。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。转载请务必保留本文链接:https://www.yangxingzhen.com/9047.html
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

拖动滑块以完成验证