国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【C站首發(fā)】全網(wǎng)最新Kubernetes(K8s)1.28版本探秘及部署 基于Containerd容器運(yùn)行時(shí)(100年證書(shū)kubeadm)

這篇具有很好參考價(jià)值的文章主要介紹了【C站首發(fā)】全網(wǎng)最新Kubernetes(K8s)1.28版本探秘及部署 基于Containerd容器運(yùn)行時(shí)(100年證書(shū)kubeadm)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

基于containerd容器運(yùn)行時(shí)部署k8s 1.28集群

一、主機(jī)準(zhǔn)備

1.1 主機(jī)操作系統(tǒng)說(shuō)明

序號(hào) 操作系統(tǒng)及版本 備注
1 CentOS7u9

1.2 主機(jī)硬件配置說(shuō)明

需求 CPU 內(nèi)存 硬盤(pán) 角色 主機(jī)名
8C 8G 1024GB master k8s-master01
8C 16G 1024GB worker(node) k8s-worker01
8C 16G 1024GB worker(node) k8s-worker02

1.3 主機(jī)配置

1.3.1 主機(jī)名配置

由于本次使用3臺(tái)主機(jī)完成kubernetes集群部署,其中1臺(tái)為master節(jié)點(diǎn),名稱(chēng)為k8s-master01;其中2臺(tái)為worker節(jié)點(diǎn),名稱(chēng)分別為:k8s-worker01及k8s-worker02

master節(jié)點(diǎn)
# hostnamectl set-hostname k8s-master01
worker01節(jié)點(diǎn)
# hostnamectl set-hostname k8s-worker01
worker02節(jié)點(diǎn)
# hostnamectl set-hostname k8s-worker02

1.3.2 主機(jī)IP地址配置

k8s-master節(jié)點(diǎn)IP地址為:192.168.10.140/24
# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.10.140"
PREFIX="24"
GATEWAY="192.168.10.2"
DNS1="119.29.29.29"
k8s-worker1節(jié)點(diǎn)IP地址為:192.168.10.141/24
# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.10.141"
PREFIX="24"
GATEWAY="192.168.10.2"
DNS1="119.29.29.29"
k8s-worker2節(jié)點(diǎn)IP地址為:192.168.10.142/24
# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.10.142"
PREFIX="24"
GATEWAY="192.168.10.2"
DNS1="119.29.29.29"

1.3.3 主機(jī)名與IP地址解析

所有集群主機(jī)均需要進(jìn)行配置。

# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.140 k8s-master01
192.168.10.141 k8s-worker01
192.168.10.142 k8s-worker02

1.3.4 防火墻配置

所有主機(jī)均需要操作。

關(guān)閉現(xiàn)有防火墻firewalld
# systemctl disable firewalld
# systemctl stop firewalld
# firewall-cmd --state
not running

1.3.5 SELINUX配置

所有主機(jī)均需要操作。修改SELinux配置需要重啟操作系統(tǒng)。

# sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# sestatus

1.3.6 時(shí)間同步配置

所有主機(jī)均需要操作。最小化安裝系統(tǒng)需要安裝ntpdate軟件。

# crontab -l
0 */1 * * * /usr/sbin/ntpdate time1.aliyun.com

1.3.7 升級(jí)操作系統(tǒng)內(nèi)核

所有主機(jī)均需要操作。

導(dǎo)入elrepo gpg key
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
安裝elrepo YUM源倉(cāng)庫(kù)
# yum -y install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
安裝kernel-ml版本,ml為最新穩(wěn)定版本,lt為長(zhǎng)期維護(hù)版本
# yum --enablerepo="elrepo-kernel" -y install kernel-lt.x86_64
設(shè)置grub2默認(rèn)引導(dǎo)為0
# grub2-set-default 0
重新生成grub2引導(dǎo)文件
# grub2-mkconfig -o /boot/grub2/grub.cfg
更新后,需要重啟,使用升級(jí)的內(nèi)核生效。
# reboot
重啟后,需要驗(yàn)證內(nèi)核是否為更新對(duì)應(yīng)的版本
# uname -r

1.3.8 配置內(nèi)核轉(zhuǎn)發(fā)及網(wǎng)橋過(guò)濾

所有主機(jī)均需要操作。

添加網(wǎng)橋過(guò)濾及內(nèi)核轉(zhuǎn)發(fā)配置文件
# 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
vm.swappiness = 0
EOF
加載br_netfilter模塊
# modprobe br_netfilter
查看是否加載
# lsmod | grep br_netfilter
br_netfilter           22256  0
bridge                151336  1 br_netfilter

1.3.9 安裝ipset及ipvsadm

所有主機(jī)均需要操作。

安裝ipset及ipvsadm
# yum -y install ipset ipvsadm
配置ipvsadm模塊加載方式
添加需要加載的模塊
# cat > /etc/sysconfig/modules/ipvs.modules <<EOF
#!/bin/bash
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack
EOF
授權(quán)、運(yùn)行、檢查是否加載
# chmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack

1.3.10 關(guān)閉SWAP分區(qū)

修改完成后需要重啟操作系統(tǒng),如不重啟,可臨時(shí)關(guān)閉,命令為swapoff -a

永遠(yuǎn)關(guān)閉swap分區(qū),需要重啟操作系統(tǒng)
# cat /etc/fstab
......

# /dev/mapper/centos-swap swap                    swap    defaults        0 0

在上一行中行首添加#

二、容器運(yùn)行時(shí) Containerd準(zhǔn)備

2.1 Containerd準(zhǔn)備

2.1.1 Containerd部署文件獲取

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

# wget https://github.com/containerd/containerd/releases/download/v1.7.3/cri-containerd-1.7.3-linux-amd64.tar.gz
# tar xf cri-containerd-1.7.3-linux-amd64.tar.gz  -C /

2.1.2 Containerd配置文件生成并修改

# mkdir /etc/containerd
# containerd config default > /etc/containerd/config.toml
# vim /etc/containerd/config.toml

sandbox_image = "registry.k8s.io/pause:3.9" 由3.8修改為3.9

2.1.3 Containerd啟動(dòng)及開(kāi)機(jī)自啟動(dòng)

# systemctl enable --now containerd
驗(yàn)證其版本
# containerd --version

2.2 runc準(zhǔn)備

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

2.2.1 libseccomp準(zhǔn)備

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

# wget https://github.com/opencontainers/runc/releases/download/v1.1.5/libseccomp-2.5.4.tar.gz
# tar xf libseccomp-2.5.4.tar.gz
# cd libseccomp-2.5.4/
# yum install gperf -y
# ./configure
# make && make install
# find / -name "libseccomp.so"

2.2.2 runc安裝

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

# wget https://github.com/opencontainers/runc/releases/download/v1.1.9/runc.amd64
# chmod +x runc.amd64
查找containerd安裝時(shí)已安裝的runc所在的位置,然后替換
# which runc
替換containerd安裝已安裝的runc
# mv runc.amd64 /usr/local/sbin/runc
執(zhí)行runc命令,如果有命令幫助則為正常
# runc

如果運(yùn)行runc命令時(shí)提示:runc: error while loading shared libraries: libseccomp.so.2: cannot open shared object file: No such file or directory,則表明runc沒(méi)有找到libseccomp,需要檢查libseccomp是否安裝,本次安裝默認(rèn)就可以查詢到。

三、K8S集群部署

3.1 K8S集群軟件YUM源準(zhǔn)備

3.1.1 google提供YUM源

# cat > /etc/yum.repos.d/k8s.repo <<EOF
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
        https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

3.1.2 阿里云提供YUM源

# cat > /etc/yum.repos.d/k8s.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

3.2 K8S集群軟件安裝

3.2.1 集群軟件安裝

所有節(jié)點(diǎn)均可安裝

默認(rèn)安裝
# yum -y install  kubeadm  kubelet kubectl
查看指定版本
# yum list kubeadm.x86_64 --showduplicates | sort -r
# yum list kubelet.x86_64 --showduplicates | sort -r
# yum list kubectl.x86_64 --showduplicates | sort -r
安裝指定版本
# yum -y install  kubeadm-1.28.X-0  kubelet-1.28.X-0 kubectl-1.28.X-0

3.2.2 配置kubelet

為了實(shí)現(xiàn)docker使用的cgroupdriver與kubelet使用的cgroup的一致性,建議修改如下文件內(nèi)容。

# vim /etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS="--cgroup-driver=systemd"
設(shè)置kubelet為開(kāi)機(jī)自啟動(dòng)即可,由于沒(méi)有生成配置文件,集群初始化后自動(dòng)啟動(dòng)
# systemctl enable kubelet

3.3 K8S集群初始化

3.3.1 替換100年證書(shū)kubeadm

# which kubeadm
/usr/bin/kubeadm
3.3.1.1 獲取kubernetes源碼

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

[root@k8s-master01 ~]# wget https://github.com/kubernetes/kubernetes/archive/refs/tags/v1.28.0.tar.gz
[root@k8s-master01 ~]# ls
v1.28.0.tar.gz
[root@k8s-master01 ~]# tar xf v1.28.0.tar.gz
[root@k8s-master01 ~]# ls
kubernetes-1.28.0
3.3.1.2 修改kubernetes源碼

修改CA證書(shū)為100年有效期(默認(rèn)為10年)

[root@k8s-master01 ~]# vim kubernetes-1.28.0/staging/src/k8s.io/client-go/util/cert/cert.go

 72         tmpl := x509.Certificate{
 73                 SerialNumber: serial,
 74                 Subject: pkix.Name{
 75                         CommonName:   cfg.CommonName,
 76                         Organization: cfg.Organization,
 77                 },
 78                 DNSNames:              []string{cfg.CommonName},
 79                 NotBefore:             notBefore,
 80                 NotAfter:              now.Add(duration365d * 100).UTC(),
 81                 KeyUsage:              x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
 82                 BasicConstraintsValid: true,
 83                 IsCA:                  true,
 84         }
修改說(shuō)明:
把文件中80行,10修改為100即可 。

修改kubeadm證書(shū)有效期為100年(默認(rèn)為1年)

 [root@k8s-master01 ~]# vim kubernetes-1.28.0/cmd/kubeadm/app/constants/constants.go
 ......
 37 const (
 38         // KubernetesDir is the directory Kubernetes owns for storing various configuration files
 39         KubernetesDir = "/etc/kubernetes"
 40         // ManifestsSubDirName defines directory name to store manifests
 41         ManifestsSubDirName = "manifests"
 42         // TempDirForKubeadm defines temporary directory for kubeadm
 43         // should be joined with KubernetesDir.
 44         TempDirForKubeadm = "tmp"
 45
 46         // CertificateBackdate defines the offset applied to notBefore for CA certificates generated by kubeadm
 47         CertificateBackdate = time.Minute * 5
 48         // CertificateValidity defines the validity for all the signed certificates generated by kubeadm
 49         CertificateValidity = time.Hour * 24 * 365 * 100

修改說(shuō)明:
把CertificateValidity = time.Hour * 24 * 365 修改為:CertificateValidity = time.Hour * 24 * 365 * 100

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

3.3.1.3 安裝Go

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

[root@k8s-master01 ~]# wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
[root@k8s-master01 ~]# tar xf go1.21.0.linux-amd64.tar.gz
[root@k8s-master01 ~]# mv go /usr/local/go
[root@k8s-master01 ~]# vim /etc/profile
[root@k8s-master01 ~]# cat /etc/profile
......
export PATH=$PATH:/usr/local/go/bin
[root@k8s-master01 ~]# source /etc/profile
[root@k8s-master01 ~]# go version
go version go1.21.0 linux/amd64
3.3.1.4 kubernetes源碼編譯
[root@k8s-master01 ~]# cd kubernetes-1.28.0/
[root@k8s-master01 kubernetes-1.28.0]# make all WHAT=cmd/kubeadm GOFLAGS=-v
[root@k8s-master01 kubernetes-1.28.0]# ls
_output
[root@k8s-master01 kubernetes-1.28.0]# ls _output/
bin  local
[root@k8s-master01 kubernetes-1.28.0]# ls _output/bin/
kubeadm  ncpu
3.3.1.5 替換所有集群主機(jī)kubeadm
[root@k8s-master01 kubernetes-1.28.0]# which kubeadm
/usr/bin/kubeadm
[root@k8s-master01 kubernetes-1.28.0]# rm -rf `which kubeadm`
[root@k8s-master01 kubernetes-1.28.0]# cp _output/bin/kubeadm /usr/bin/kubeadm
[root@k8s-master01 kubernetes-1.28.0]# which kubeadm
/usr/bin/kubeadm
[root@k8s-worker01 ~]# rm -rf `which kubeadm`
[root@k8s-worker01 ~]# rm -rf `which kubeadm`
[root@k8s-master01 kubernetes-1.28.0]# scp _output/bin/kubeadm 192.168.10.141:/usr/bin/kubeadm
[root@k8s-master01 kubernetes-1.28.0]# scp _output/bin/kubeadm 192.168.10.142:/usr/bin/kubeadm

3.3.2 獲取kubernetes 1.28組件容器鏡像

[root@k8s-master01 ~]# kubeadm config images list
registry.k8s.io/kube-apiserver:v1.28.0
registry.k8s.io/kube-controller-manager:v1.28.0
registry.k8s.io/kube-scheduler:v1.28.0
registry.k8s.io/kube-proxy:v1.28.0
registry.k8s.io/pause:3.9
registry.k8s.io/etcd:3.5.9-0
registry.k8s.io/coredns/coredns:v1.10.1
[root@k8s-master01 ~]# kubeadm config images pull

3.3.3 kubernetes 1.28集群初始化

[root@k8s-master01 ~]# kubeadm init --kubernetes-version=v1.28.0 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.10.140  --cri-socket unix:///var/run/containerd/containerd.sock
[init] Using Kubernetes version: v1.28.0
[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-master01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.10.140]
[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-master01 localhost] and IPs [192.168.10.140 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master01 localhost] and IPs [192.168.10.140 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 20.502191 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-master01 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-master01 as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: hd74hg.r8l1pe4tivwyjz73
[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.10.140:6443 --token hd74hg.r8l1pe4tivwyjz73 \
        --discovery-token-ca-cert-hash sha256:29a00daed8d96dfa8e913ab4c0a8c4037f1c253a20742ca8913932dd7c8b3bd1

3.4 工作節(jié)點(diǎn)加入集群

[root@k8s-worker01 ~]# kubeadm join 192.168.10.140:6443 --token hd74hg.r8l1pe4tivwyjz73 \
>         --discovery-token-ca-cert-hash sha256:29a00daed8d96dfa8e913ab4c0a8c4037f1c253a20742ca8913932dd7c8b3bd1 --cri-socket unix:///var/run/containerd/containerd.sock
[root@k8s-worker02 ~]# kubeadm join 192.168.10.140:6443 --token hd74hg.r8l1pe4tivwyjz73 \
>         --discovery-token-ca-cert-hash sha256:29a00daed8d96dfa8e913ab4c0a8c4037f1c253a20742ca8913932dd7c8b3bd1 --cri-socket unix:///var/run/containerd/containerd.sock

3.5 驗(yàn)證K8S集群節(jié)點(diǎn)是否可用

[root@k8s-master01 ~]# kubectl get nodes
NAME           STATUS   ROLES           AGE   VERSION
k8s-master01   Ready    control-plane   15m   v1.28.0
k8s-worker01   Ready    <none>          13m   v1.28.0
k8s-worker02   Ready    <none>          13m   v1.28.0

3.6 驗(yàn)證證書(shū)有效期

[root@k8s-master01 ~]# openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text | grep ' Not '
            Not Before: Aug 21 10:24:00 2023 GMT
            Not After : Jul 28 10:29:00 2123 GMT
[root@k8s-master01 ~]# kubeadm certs check-expiration
[check-expiration] Reading configuration from the cluster...
[check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'

CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE AUTHORITY   EXTERNALLY MANAGED
admin.conf                 Jul 28, 2123 10:29 UTC   99y             ca                      no
apiserver                  Jul 28, 2123 10:29 UTC   99y             ca                      no
apiserver-etcd-client      Jul 28, 2123 10:29 UTC   99y             etcd-ca                 no
apiserver-kubelet-client   Jul 28, 2123 10:29 UTC   99y             ca                      no
controller-manager.conf    Jul 28, 2123 10:29 UTC   99y             ca                      no
etcd-healthcheck-client    Jul 28, 2123 10:29 UTC   99y             etcd-ca                 no
etcd-peer                  Jul 28, 2123 10:29 UTC   99y             etcd-ca                 no
etcd-server                Jul 28, 2123 10:29 UTC   99y             etcd-ca                 no
front-proxy-client         Jul 28, 2123 10:29 UTC   99y             front-proxy-ca          no
scheduler.conf             Jul 28, 2123 10:29 UTC   99y             ca                      no

CERTIFICATE AUTHORITY   EXPIRES                  RESIDUAL TIME   EXTERNALLY MANAGED
ca                      Aug 18, 2033 10:29 UTC   99y              no
etcd-ca                 Aug 18, 2033 10:29 UTC   99y              no
front-proxy-ca          Aug 18, 2033 10:29 UTC   99y              no

四、網(wǎng)絡(luò)插件calico部署

calico訪問(wèn)鏈接:https://projectcalico.docs.tigera.io/about/about-calico

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

k8s內(nèi)核版本,kubernetes,云原生,docker,微服務(wù),paas,devops,jenkins

# kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml
# wget https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml
# vim custom-resources.yaml


# cat custom-resources.yaml


# This section includes base Calico installation configuration.
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.Installation
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
  name: default
spec:
  # Configures Calico networking.
  calicoNetwork:
    # Note: The ipPools section cannot be modified post-install.
    ipPools:
    - blockSize: 26
      cidr: 10.244.0.0/16 修改此行內(nèi)容為初始化時(shí)定義的pod network cidr
      encapsulation: VXLANCrossSubnet
      natOutgoing: Enabled
      nodeSelector: all()

---

# This section configures the Calico API server.
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.APIServer
apiVersion: operator.tigera.io/v1
kind: APIServer
metadata:
  name: default
spec: {}
# kubectl create -f custom-resources.yaml

installation.operator.tigera.io/default created
apiserver.operator.tigera.io/default created
[root@k8s-master01 ~]# kubectl get pods -n calico-system
NAME                                       READY   STATUS    RESTARTS   AGE
calico-kube-controllers-6bb86c78b4-cnr9l   1/1     Running   0          2m26s
calico-node-86cs9                          1/1     Running   0          2m26s
calico-node-gjgcc                          1/1     Running   0          2m26s
calico-node-hlr69                          1/1     Running   0          2m26s
calico-typha-6f877c9d8f-8f5fb              1/1     Running   0          2m25s
calico-typha-6f877c9d8f-spxqf              1/1     Running   0          2m26s
csi-node-driver-9b8nd                      2/2     Running   0          2m26s
csi-node-driver-rg6dc                      2/2     Running   0          2m26s
csi-node-driver-tf82w                      2/2     Running   0          2m26s

operator.tigera.io/v1
kind: APIServer
metadata:
name: default
spec: {}文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-713368.html




~~~powershell
# kubectl create -f custom-resources.yaml

installation.operator.tigera.io/default created
apiserver.operator.tigera.io/default created

到了這里,關(guān)于【C站首發(fā)】全網(wǎng)最新Kubernetes(K8s)1.28版本探秘及部署 基于Containerd容器運(yùn)行時(shí)(100年證書(shū)kubeadm)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • [k8s] 基于ubuntu22部署k8s1.28記錄

    k8s1.28部署已經(jīng)不依賴docker了,所以不需要安裝docker。同理:如果想查看鏡像和運(yùn)行容器,也不能用docker命令去查詢了:需要使用crictl。不過(guò)crictl命令參數(shù)兼容docker,所以使用上手沒(méi)有啥難度。 根據(jù)k8s官方文檔:https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kube

    2024年02月11日
    瀏覽(21)
  • CentOS7使用kubeadm部署k8s-1.28集群

    CentOS7使用kubeadm部署k8s-1.28集群

    參考資料:生產(chǎn)環(huán)境 記錄使用CentOS7.9進(jìn)行k8s-1.28版本部署,運(yùn)行時(shí)環(huán)境使用containerd,網(wǎng)絡(luò)插件使用calic,集群搭建完成后。搭建NFS共享存儲(chǔ)環(huán)境,測(cè)試運(yùn)行pod并掛載使用持久卷。 主機(jī)名 **IP地址 ** 角色 基礎(chǔ)組件 el7-linux-node-01 192.168.240.11 k8s-master kubeadm,kubelet,kubectl,containerd,nf

    2024年04月26日
    瀏覽(28)
  • Kubernetes[k8s] 最新版1.27.3 - 1.28.0安裝教程,使用containerd模式

    公司使用的是交老的k8s版本(1.16),由于老版本的K8s對(duì)于現(xiàn)在很多新特性不支持,所以需要升級(jí)到新版本。目前2023年7月11日最新版本的k8s是v1.27.3。通過(guò)參考官方文檔進(jìn)行k8s部署工作。其中涉及到操作系統(tǒng)配置、防火墻配置、私有鏡像倉(cāng)庫(kù)等。 推薦一個(gè)AI工具:態(tài)靈AI: chata

    2024年02月06日
    瀏覽(31)
  • k8s(1.28)使用Helm安裝metrics-server

    提示:文章寫(xiě)完后,目錄可以自動(dòng)生成,如何生成可參考右邊的幫助文檔 提示:這里可以添加本文要記錄的大概內(nèi)容: metrics-server安裝后,可以查看集群的node和pod的CPU和Memory占用情況,非常有用。 提示:以下是本篇文章正文內(nèi)容,下面案例可供參考 官網(wǎng)地址:https://github

    2024年02月19日
    瀏覽(41)
  • 基于containerd容器運(yùn)行時(shí),kubeadmin部署k8s 1.28集群

    基于containerd容器運(yùn)行時(shí),kubeadmin部署k8s 1.28集群

    centos7u9 序號(hào) 主機(jī)名 ip地址 CPU 內(nèi)存 硬盤(pán) 1 k8s-master1 192.168.1.200 2C 2G 100G 2 k8s-worker1 192.168.1.201 2C 2G 100G 3 k8s-worker2 192.168.1.202 2C 2G 100G 1.3.1主機(jī)名配置 vi /etc/sysconfig/network-scripts/ifcfg-ens33 1.3.3主機(jī)名與IP地址解析(hosts) vi /etc/hosts 1.3.4防火墻配置 關(guān)閉防火墻firewalld 1.3.5SELINUX配置 修改

    2024年02月01日
    瀏覽(37)
  • K8S(1.28)--部署ingress-nginx(1.9.1)

    K8S(1.28)--部署ingress-nginx(1.9.1)

    原文網(wǎng)址:K8S(1.28)--部署ingress-nginx(1.9.1)-CSDN博客 本文介紹K8S部署ingress-nginx的方法。 本文使用的K8S和ingress-nginx都是最新的版本。 官網(wǎng)地址 https://kubernetes.github.io/ingress-nginx/deploy/ Ingress里Nginx的代理流程: 1.確定版本 首先確定版本:https://github.com/kubernetes/ingress-nginx 我K8S是1.2

    2024年02月20日
    瀏覽(27)
  • K8S最新版本集群部署(v1.28) + 容器引擎Docker部署(上)

    K8S最新版本集群部署(v1.28) + 容器引擎Docker部署(上)

    ??上一集:win11+vmware17+centos7.9環(huán)境搭建 *??主目錄:溫故知新專(zhuān)欄 ??下一集:K8S最新版本集群部署(v1.28) + 容器引擎Docker部署(下) 之前部署過(guò)dolphinscheduler3.1.8,看頁(yè)面增加了K8S模塊,所以想著部署一下K8S,學(xué)習(xí)一下,而且海豚調(diào)度也提供了K8S部署方式,經(jīng)過(guò)一番了解,發(fā)現(xiàn)

    2024年02月11日
    瀏覽(28)
  • K8S最新版本集群部署(v1.28) + 容器引擎Docker部署(下)

    K8S最新版本集群部署(v1.28) + 容器引擎Docker部署(下)

    ??上一集:K8S最新版本集群部署(v1.28) + 容器引擎Docker部署(上) *??主目錄:溫故知新專(zhuān)欄 ??下一集:Kubernetes可視化管理工具Kuboard部署使用及k8s常用命令梳理記錄 kubectl 是使用 Kubernetes API 與 Kubernetes 集群的控制面進(jìn)行通信的命令行工具。詳見(jiàn)官網(wǎng)安裝步驟 ??下載kube

    2024年02月09日
    瀏覽(33)
  • Centos7安裝部署k8s(kubernetes)最新v1.27.1版本超詳細(xì)安裝教程

    從零開(kāi)始的k8s安裝 硬件配置要求 cpu = 2核 硬盤(pán) = 20G 內(nèi)存 = 2G 節(jié)點(diǎn)數(shù)量建議為奇數(shù)(3, 5, 7, 9等)(1臺(tái)好像也能搭,沒(méi)試過(guò)) 以下命令出除特殊要求外,其余都建議在master主機(jī)執(zhí)行 本教程配置如下 主機(jī)名 IP 配置 master 192.168.42.150 2核+2G+20G node1 192.168.42.151 2核+2G+20G node2 192.168.

    2024年02月11日
    瀏覽(59)
  • Kubernetes(K8s 1.28.x)部署---超詳細(xì)

    Kubernetes(K8s 1.28.x)部署---超詳細(xì)

    目錄 一、基礎(chǔ)環(huán)境配置(所有主機(jī)均要配置) 1、配置IP地址和主機(jī)名、hosts解析 2、關(guān)閉防火墻、禁用SELinux 3、安裝常用軟件 4、配置時(shí)間同步 5、禁用Swap分區(qū) 6、修改linux的內(nèi)核參數(shù) 7、配置ipvs功能 二、容器環(huán)境操作 1、定制軟件源 2、安裝最新版docker 3、配置docker加速器 4、

    2024年02月11日
    瀏覽(25)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包