天天日夜夜添_精品国产99久久久久久人裸体 _成人app在线观看_日韩色网站

新聞資訊

    Step2: 安裝前準(zhǔn)備

    1、改主機(jī)名

    demon@ubuntu2204-master:~$ sudo vi /etc/hostname 
    ...
    demon@ubuntu2204-master:~$ cat /etc/hostname
    ubuntu2204-master
    demon@ubuntu2204-master:~$

    2、設(shè)置流量轉(zhuǎn)發(fā)

    修改 的配置,啟用“”模塊,讓 可以檢查和轉(zhuǎn)發(fā)網(wǎng)絡(luò)流量。

    cat <br_netfilter
    EOF

    cat <net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    net.ipv4.ip_forward=1 # better than modify /etc/sysctl.conf
    EOF

    sudo sysctl --system

    3、關(guān)閉 Linux Swap 分區(qū)

    基于安全性(如在官方文檔中承諾的 只會(huì)在內(nèi)存中讀寫(xiě),不會(huì)落盤(pán))、利于保證節(jié)點(diǎn)同步一致性等原因,從 1.8 版開(kāi)始,就在它的文檔中明確聲明了它默認(rèn)不支持 Swap 分區(qū)計(jì)算機(jī)中集群是什么意思,在未關(guān)閉 Swap 分區(qū)的機(jī)器中,集群將直接無(wú)法啟動(dòng)。

    sudo cp /etc/fstab /etc/fstab_bak
    sudo swapoff -a
    sudo sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab

    4、注冊(cè) apt 軟件源

    這里選擇阿里云:

    sudo apt install -y apt-transport-https ca-certificates curl

    curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add -

    cat <deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
    EOF

    sudo apt update

    Step3: 安裝 , ,

    這里先解釋一下這三個(gè)工具的作用:

    計(jì)算機(jī)集群技術(shù)實(shí)施的內(nèi)容_計(jì)算機(jī)集群技術(shù)_計(jì)算機(jī)中集群是什么意思

    如果不指定版本,則默認(rèn)安裝最新版本,筆者這里選擇的版本是 1.25.3:

    sudo apt install -y kubeadm=1.25.3-00 kubelet=1.25.3-00 kubectl=1.25.3-00

    鎖定版本,不讓它們自動(dòng)更新:

    demon@ubuntu2204-master:~$ sudo apt-mark hold kubeadm kubelet kubectl
    kubeadm set on hold.
    kubelet set on hold.
    kubectl set on hold.
    demon@ubuntu2204-master:~$

    查看安裝結(jié)果:

    demon@ubuntu2204-master:~$ kubeadm version
    kubeadm version: &version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.3", GitCommit:"434bfd82814af038ad94d62ebe59b133fcb50506", GitTreeState:"clean", BuildDate:"2022-10-12T10:55:36Z", GoVersion:"go1.19.2", Compiler:"gc", Platform:"linux/arm64"}
    demon@ubuntu2204-master:~$
    demon@ubuntu2204-master:~$ kubectl version
    WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
    Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.3", GitCommit:"434bfd82814af038ad94d62ebe59b133fcb50506", GitTreeState:"clean", BuildDate:"2022-10-12T10:57:26Z", GoVersion:"go1.19.2", Compiler:"gc", Platform:"linux/arm64"}
    Kustomize Version: v4.5.7
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    demon@ubuntu2204-master:~$
    demon@ubuntu2204-master:~$ kubelet --version
    Kubernetes v1.25.3
    demon@ubuntu2204-master:~$

    了解后續(xù)需要的鏡像版本:

    demon@ubuntu2204-master:~$ sudo kubeadm config images list --kubernetes-version v1.25.3
    registry.k8s.io/kube-apiserver:v1.25.3
    registry.k8s.io/kube-controller-manager:v1.25.3
    registry.k8s.io/kube-scheduler:v1.25.3
    registry.k8s.io/kube-proxy:v1.25.3
    registry.k8s.io/pause:3.8
    registry.k8s.io/etcd:3.5.4-0
    registry.k8s.io/coredns/coredns:v1.9.3
    demon@ubuntu2204-master:~$

    Step4: 初始化集群控制面

    1、啟動(dòng) ,保證開(kāi)機(jī)執(zhí)行

    $ sudo systemctl start kubelet
    $ sudo systemctl enable kubelet

    2、開(kāi)始部署,這里切換到 root 賬號(hào),而不是使用sudo

    kubeadm init \
    --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers \
    --pod-network-cidr=10.10.0.0/16 \
    --apiserver-advertise-address=192.168.10.128 \
    --kubernetes-version=v1.25.3 \
    --v=5

    解釋一下這里的幾個(gè)參數(shù):

    計(jì)算機(jī)集群技術(shù)實(shí)施的內(nèi)容_計(jì)算機(jī)集群技術(shù)_計(jì)算機(jī)中集群是什么意思

    安裝日志:

    root@ubuntu2204-master:~# kubeadm init \
    --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers \
    --pod-network-cidr=10.10.0.0/16 \
    --apiserver-advertise-address=192.168.10.128 \
    --kubernetes-version=v1.25.3 \
    > --v=5
    I1116 15:56:26.815643 2036 initconfiguration.go:116] detected and using CRI socket: unix:///var/run/containerd/containerd.sock
    I1116 15:56:26.815827 2036 kubelet.go:196] the value of KubeletConfiguration.cgroupDriver is empty; setting it to "systemd"
    [init] Using Kubernetes version: v1.25.3
    [preflight] Running pre-flight checks
    I1116 15:56:26.819499 2036 checks.go:568] validating Kubernetes and kubeadm version
    I1116 15:56:26.819566 2036 checks.go:168] validating if the firewall is enabled and active
    I1116 15:56:26.825072 2036 checks.go:203] validating availability of port 6443
    I1116 15:56:26.825237 2036 checks.go:203] validating availability of port 10259
    I1116 15:56:26.825299 2036 checks.go:203] validating availability of port 10257
    I1116 15:56:26.825384 2036 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-apiserver.yaml
    I1116 15:56:26.825516 2036 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-controller-manager.yaml
    I1116 15:56:26.825620 2036 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-scheduler.yaml
    I1116 15:56:26.825673 2036 checks.go:280] validating the existence of file /etc/kubernetes/manifests/etcd.yaml
    I1116 15:56:26.825728 2036 checks.go:430] validating if the connectivity type is via proxy or direct
    I1116 15:56:26.825843 2036 checks.go:469] validating http connectivity to first IP address in the CIDR
    I1116 15:56:26.825911 2036 checks.go:469] validating http connectivity to first IP address in the CIDR
    I1116 15:56:26.825960 2036 checks.go:104] validating the container runtime
    I1116 15:56:26.887241 2036 checks.go:329] validating the contents of file /proc/sys/net/bridge/bridge-nf-call-iptables
    I1116 15:56:26.887388 2036 checks.go:329] validating the contents of file /proc/sys/net/ipv4/ip_forward
    I1116 15:56:26.887405 2036 checks.go:644] validating whether swap is enabled or not
    I1116 15:56:26.887455 2036 checks.go:370] validating the presence of executable crictl
    I1116 15:56:26.887494 2036 checks.go:370] validating the presence of executable conntrack
    I1116 15:56:26.887521 2036 checks.go:370] validating the presence of executable ip
    I1116 15:56:26.887557 2036 checks.go:370] validating the presence of executable iptables
    I1116 15:56:26.887614 2036 checks.go:370] validating the presence of executable mount
    I1116 15:56:26.887661 2036 checks.go:370] validating the presence of executable nsenter
    I1116 15:56:26.887701 2036 checks.go:370] validating the presence of executable ebtables
    I1116 15:56:26.887738 2036 checks.go:370] validating the presence of executable ethtool
    I1116 15:56:26.887766 2036 checks.go:370] validating the presence of executable socat
    I1116 15:56:26.887809 2036 checks.go:370] validating the presence of executable tc
    I1116 15:56:26.887844 2036 checks.go:370] validating the presence of executable touch
    I1116 15:56:26.887855 2036 checks.go:516] running all checks
    [WARNING SystemVerification]: missing optional cgroups: blkio
    I1116 15:56:26.896081 2036 checks.go:401] checking whether the given node name is valid and reachable using net.LookupHost
    I1116 15:56:26.896538 2036 checks.go:610] validating kubelet version
    I1116 15:56:26.935223 2036 checks.go:130] validating if the "kubelet" service is enabled and active
    I1116 15:56:26.947920 2036 checks.go:203] validating availability of port 10250
    I1116 15:56:26.948061 2036 checks.go:203] validating availability of port 2379
    I1116 15:56:26.948111 2036 checks.go:203] validating availability of port 2380
    I1116 15:56:26.948157 2036 checks.go:243] validating the existence and emptiness of directory /var/lib/etcd
    [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'
    I1116 15:56:26.948474 2036 checks.go:832] using image pull policy: IfNotPresent
    I1116 15:56:26.964706 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.25.3
    I1116 15:56:26.978755 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.25.3
    I1116 15:56:27.000585 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.25.3
    I1116 15:56:27.017285 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.25.3
    I1116 15:56:27.032953 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.8
    I1116 15:56:27.048539 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.4-0
    I1116 15:56:27.064166 2036 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.9.3
    [certs] Using certificateDir folder "/etc/kubernetes/pki"
    I1116 15:56:27.064309 2036 certs.go:112] creating a new certificate authority for ca
    [certs] Generating "ca" certificate and key
    I1116 15:56:27.115296 2036 certs.go:522] validating certificate period for ca certificate
    [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 ubuntu2204-master] and IPs [10.96.0.1 192.168.10.128]
    [certs] Generating "apiserver-kubelet-client" certificate and key
    I1116 15:56:27.397793 2036 certs.go:112] creating a new certificate authority for front-proxy-ca
    [certs] Generating "front-proxy-ca" certificate and key
    I1116 15:56:27.611526 2036 certs.go:522] validating certificate period for front-proxy-ca certificate
    [certs] Generating "front-proxy-client" certificate and key
    I1116 15:56:27.756970 2036 certs.go:112] creating a new certificate authority for etcd-ca
    [certs] Generating "etcd/ca" certificate and key
    I1116 15:56:27.825701 2036 certs.go:522] validating certificate period for etcd/ca certificate
    [certs] Generating "etcd/server" certificate and key
    [certs] etcd/server serving cert is signed for DNS names [localhost ubuntu2204-master] and IPs [192.168.10.128 127.0.0.1 ::1]
    [certs] Generating "etcd/peer" certificate and key
    [certs] etcd/peer serving cert is signed for DNS names [localhost ubuntu2204-master] and IPs [192.168.10.128 127.0.0.1 ::1]
    [certs] Generating "etcd/healthcheck-client" certificate and key
    [certs] Generating "apiserver-etcd-client" certificate and key
    I1116 15:56:28.545309 2036 certs.go:78] creating new public/private key files for signing service account users
    [certs] Generating "sa" key and public key
    [kubeconfig] Using kubeconfig folder "/etc/kubernetes"
    I1116 15:56:28.708973 2036 kubeconfig.go:103] creating kubeconfig file for admin.conf
    [kubeconfig] Writing "admin.conf" kubeconfig file
    I1116 15:56:28.784633 2036 kubeconfig.go:103] creating kubeconfig file for kubelet.conf
    [kubeconfig] Writing "kubelet.conf" kubeconfig file
    I1116 15:56:28.848427 2036 kubeconfig.go:103] creating kubeconfig file for controller-manager.conf
    [kubeconfig] Writing "controller-manager.conf" kubeconfig file
    I1116 15:56:29.059470 2036 kubeconfig.go:103] creating kubeconfig file for scheduler.conf
    [kubeconfig] Writing "scheduler.conf" kubeconfig file
    I1116 15:56:29.185240 2036 kubelet.go:66] Stopping the kubelet
    [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"
    I1116 15:56:29.363351 2036 manifests.go:99] [control-plane] getting StaticPodSpecs
    I1116 15:56:29.363501 2036 certs.go:522] validating certificate period for CA certificate
    I1116 15:56:29.363535 2036 manifests.go:125] [control-plane] adding volume "ca-certs" for component "kube-apiserver"
    I1116 15:56:29.363538 2036 manifests.go:125] [control-plane] adding volume "etc-ca-certificates" for component "kube-apiserver"
    I1116 15:56:29.363541 2036 manifests.go:125] [control-plane] adding volume "etc-pki" for component "kube-apiserver"
    I1116 15:56:29.363543 2036 manifests.go:125] [control-plane] adding volume "k8s-certs" for component "kube-apiserver"
    I1116 15:56:29.363546 2036 manifests.go:125] [control-plane] adding volume "usr-local-share-ca-certificates" for component "kube-apiserver"
    I1116 15:56:29.363549 2036 manifests.go:125] [control-plane] adding volume "usr-share-ca-certificates" for component "kube-apiserver"
    I1116 15:56:29.364668 2036 manifests.go:154] [control-plane] wrote static Pod manifest for component "kube-apiserver" to "/etc/kubernetes/manifests/kube-apiserver.yaml"
    [control-plane] Creating static Pod manifest for "kube-controller-manager"
    I1116 15:56:29.364676 2036 manifests.go:99] [control-plane] getting StaticPodSpecs
    I1116 15:56:29.364760 2036 manifests.go:125] [control-plane] adding volume "ca-certs" for component "kube-controller-manager"
    I1116 15:56:29.364764 2036 manifests.go:125] [control-plane] adding volume "etc-ca-certificates" for component "kube-controller-manager"
    I1116 15:56:29.364766 2036 manifests.go:125] [control-plane] adding volume "etc-pki" for component "kube-controller-manager"
    I1116 15:56:29.364769 2036 manifests.go:125] [control-plane] adding volume "flexvolume-dir" for component "kube-controller-manager"
    I1116 15:56:29.364771 2036 manifests.go:125] [control-plane] adding volume "k8s-certs" for component "kube-controller-manager"
    I1116 15:56:29.364773 2036 manifests.go:125] [control-plane] adding volume "kubeconfig" for component "kube-controller-manager"
    I1116 15:56:29.364776 2036 manifests.go:125] [control-plane] adding volume "usr-local-share-ca-certificates" for component "kube-controller-manager"
    I1116 15:56:29.364778 2036 manifests.go:125] [control-plane] adding volume "usr-share-ca-certificates" for component "kube-controller-manager"
    I1116 15:56:29.365051 2036 manifests.go:154] [control-plane] wrote static Pod manifest for component "kube-controller-manager" to "/etc/kubernetes/manifests/kube-controller-manager.yaml"
    [control-plane] Creating static Pod manifest for "kube-scheduler"
    I1116 15:56:29.365056 2036 manifests.go:99] [control-plane] getting StaticPodSpecs
    I1116 15:56:29.365124 2036 manifests.go:125] [control-plane] adding volume "kubeconfig" for component "kube-scheduler"
    I1116 15:56:29.365267 2036 manifests.go:154] [control-plane] wrote static Pod manifest for component "kube-scheduler" to "/etc/kubernetes/manifests/kube-scheduler.yaml"
    [etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
    I1116 15:56:29.365641 2036 local.go:65] [etcd] wrote Static Pod manifest for a local etcd member to "/etc/kubernetes/manifests/etcd.yaml"
    I1116 15:56:29.365685 2036 waitcontrolplane.go:83] [wait-control-plane] Waiting for the API server to be healthy
    [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 4.501675 seconds
    I1116 15:56:33.870817 2036 uploadconfig.go:110] [upload-config] Uploading the kubeadm ClusterConfiguration to a ConfigMap
    [upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
    I1116 15:56:33.876187 2036 uploadconfig.go:124] [upload-config] Uploading the kubelet component config to a ConfigMap
    [kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
    I1116 15:56:33.880965 2036 uploadconfig.go:129] [upload-config] Preserving the CRISocket information for the control-plane node
    I1116 15:56:33.880980 2036 patchnode.go:31] [patchnode] Uploading the CRI Socket information "unix:///var/run/containerd/containerd.sock" to the Node API object "ubuntu2204-master" as an annotation
    [upload-certs] Skipping phase. Please see --upload-certs
    [mark-control-plane] Marking the node ubuntu2204-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 ubuntu2204-master as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
    [bootstrap-token] Using token: xic9xj.h4m8entuwgbz92m4
    [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
    I1116 15:56:34.939896 2036 clusterinfo.go:47] [bootstrap-token] loading admin kubeconfig
    I1116 15:56:34.940276 2036 clusterinfo.go:58] [bootstrap-token] copying the cluster from admin.conf to the bootstrap kubeconfig
    I1116 15:56:34.940432 2036 clusterinfo.go:70] [bootstrap-token] creating/updating ConfigMap in kube-public namespace
    I1116 15:56:34.942150 2036 clusterinfo.go:84] creating the RBAC rules for exposing the cluster-info ConfigMap in the kube-public namespace
    I1116 15:56:34.945159 2036 kubeletfinalize.go:90] [kubelet-finalize] Assuming that kubelet client certificate rotation is enabled: found "/var/lib/kubelet/pki/kubelet-client-current.pem"
    [kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
    I1116 15:56:34.945791 2036 kubeletfinalize.go:134] [kubelet-finalize] Restarting the kubelet to enable client certificate rotation
    [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.128:6443 --token tu3oa9.o08w1z4c8yfrkoxi \
    --discovery-token-ca-cert-hash sha256:b09777337820602596abd84012da770ec8b1637dbdd157e73e765ba0c7790d2b
    root@ubuntu2204-master:~#

    3、按照上面日志最后部分給的提示進(jìn)行 kube 配置

     mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config

    如果是 root 用戶,可以將下面這行加入 .,重新登錄后生效。

    export KUBECONFIG=/etc/kubernetes/admin.conf

    Step5: 安裝網(wǎng)絡(luò)插件

    將底層容器網(wǎng)絡(luò)抽象成了 CNI[5],即容器網(wǎng)絡(luò)插件:

    CNI ( ), a Cloud , of a and for to in Linux , along with a of . CNI only with of and when the is . of this focus, CNI has a wide range of and the is to .

    官方列出了非常多的網(wǎng)絡(luò)插件,比如 ,Weave,, 等,不同插件的底層原理和實(shí)現(xiàn)方式有所不同,但都遵循 CNI 規(guī)范。作為入門(mén)學(xué)習(xí),筆者這里選擇最簡(jiǎn)單的 插件。我們從 獲取安裝文件 kube-.yml[6],然后對(duì)其進(jìn)行修改:

    net-conf.json: |
    {
    "Network": "10.244.0.0/16",
    "Backend": {
    "Type": "vxlan"
    }
    }

    將上面的 調(diào)整為我們之前初始化集群時(shí)設(shè)置的 pod 網(wǎng)段:

    net-conf.json: |
    {
    "Network": "10.10.0.0/16",
    "Backend": {
    "Type": "vxlan"
    }
    }

    計(jì)算機(jī)集群技術(shù)_計(jì)算機(jī)集群技術(shù)實(shí)施的內(nèi)容_計(jì)算機(jī)中集群是什么意思

    最后我們使用 apply進(jìn)行安裝:

    kubectl apply -f kube-flannel.yml

    Step6:優(yōu)化(可選)

    移除 上的污點(diǎn)

    移除污點(diǎn)是為了讓 節(jié)點(diǎn)可以部署業(yè)務(wù)服務(wù)[7]:

    demon@ubuntu2204-master:~$ kubectl describe node ubuntu2204-master
    Name: ubuntu2204-master
    Roles: control-plane
    Labels: beta.kubernetes.io/arch=arm64
    beta.kubernetes.io/os=linux
    kubernetes.io/arch=arm64
    kubernetes.io/hostname=ubuntu2204-master
    kubernetes.io/os=linux
    node-role.kubernetes.io/control-plane=
    node.kubernetes.io/exclude-from-external-load-balancers=
    Annotations: flannel.alpha.coreos.com/backend-data: {"VNI":1,"VtepMAC":"1a:9b:f1:7d:dd:c4"}
    flannel.alpha.coreos.com/backend-type: vxlan
    flannel.alpha.coreos.com/kube-subnet-manager: true
    flannel.alpha.coreos.com/public-ip: 192.168.10.128
    kubeadm.alpha.kubernetes.io/cri-socket: unix:///var/run/containerd/containerd.sock
    node.alpha.kubernetes.io/ttl: 0
    volumes.kubernetes.io/controller-managed-attach-detach: true
    CreationTimestamp: Wed, 16 Nov 2022 15:56:32 +0800
    Taints: node-role.kubernetes.io/control-plane:NoSchedule
    Unschedulable: false
    Lease:
    HolderIdentity: ubuntu2204-master
    AcquireTime:
    RenewTime: Wed, 16 Nov 2022 21:33:49 +0800
    Conditions:
    ...
    ...
    ...

    找到: node-role..io/-plane:[8],然后將其移除:

    demon@ubuntu2204-master:~$ kubectl taint nodes ubuntu2204-master node-role.kubernetes.io/control-plane:NoSchedule-
    node/ubuntu2204-master untainted
    demon@ubuntu2204-master:~$

    啟用 命令自動(dòng)補(bǔ)全功能

    bash:

    $ echo 'source <(kubectl completion bash)' >> ~/.bashrc
    $ echo 'source /usr/share/bash-completion/bash_completion' >> ~/.bashrc

    zsh:

    $ echo 'source <(kubectl completion zsh)' >> ~/.zshrc

    調(diào)整 范圍

    計(jì)算機(jī)中集群是什么意思_計(jì)算機(jī)集群技術(shù)實(shí)施的內(nèi)容_計(jì)算機(jī)集群技術(shù)

    默認(rèn)的 范圍為 30000-32767,本地開(kāi)發(fā)調(diào)試可以將其調(diào)大一些。

    export apiserver_pods=$(kubectl get pods --selector=component=kube-apiserver -n kube-system --output=jsonpath={.items..metadata.name})

    kubectl delete pod $apiserver_pods -n kube-system

    $ kubectl describe pod $apiserver_pods -n kube-system | grep 5000
    --service-node-port-range=5000-32767

    Step7:增加 節(jié)點(diǎn)

    節(jié)點(diǎn)的基礎(chǔ)安裝部分與 節(jié)點(diǎn)一致,我們安裝到Step 3就夠了。

    接著將 修改為默認(rèn)啟動(dòng):

    sudo systemctl enable kubelet

    然后在當(dāng)前 節(jié)點(diǎn)上運(yùn)行下面的命令加入集群:

    kubeadm join 192.168.10.128:6443 --token tu3oa9.o08w1z4c8yfrkoxi \
    --discovery-token-ca-cert-hash sha256:b09777337820602596abd84012da770ec8b1637dbdd157e73e765ba0c7790d2b

    該命令來(lái)自前面Step 4中 init最后的日志:

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

    kubeadm join 192.168.10.128:6443 --token tu3oa9.o08w1z4c8yfrkoxi \
    --discovery-token-ca-cert-hash sha256:b09777337820602596abd84012da770ec8b1637dbdd157e73e765ba0c7790d2b

    上面的 token 有效期為 24 小時(shí),如果過(guò)期可以使用如下命令重新生成:

    kubeadm token create --print-join-command

    節(jié)點(diǎn)加入日志:

    計(jì)算機(jī)集群技術(shù)實(shí)施的內(nèi)容_計(jì)算機(jī)集群技術(shù)_計(jì)算機(jī)中集群是什么意思

    root@ubuntu2204-worker:~# kubeadm join 192.168.10.128:6443 --token tu3oa9.o08w1z4c8yfrkoxi         --discovery-token-ca-cert-hash sha256:b09777337820602596abd84012da770ec8b1637dbdd157e73e765ba0c7790d2b      --v=5
    I1117 09:49:35.953178 2006 join.go:416] [preflight] found NodeName empty; using OS hostname as NodeName
    I1117 09:49:35.953532 2006 initconfiguration.go:116] detected and using CRI socket: unix:///var/run/containerd/containerd.sock
    [preflight] Running pre-flight checks
    I1117 09:49:35.953605 2006 preflight.go:92] [preflight] Running general checks
    I1117 09:49:35.953661 2006 checks.go:280] validating the existence of file /etc/kubernetes/kubelet.conf
    I1117 09:49:35.953673 2006 checks.go:280] validating the existence of file /etc/kubernetes/bootstrap-kubelet.conf
    I1117 09:49:35.953710 2006 checks.go:104] validating the container runtime
    I1117 09:49:35.974555 2006 checks.go:329] validating the contents of file /proc/sys/net/bridge/bridge-nf-call-iptables
    I1117 09:49:35.974601 2006 checks.go:329] validating the contents of file /proc/sys/net/ipv4/ip_forward
    I1117 09:49:35.974626 2006 checks.go:644] validating whether swap is enabled or not
    I1117 09:49:35.974645 2006 checks.go:370] validating the presence of executable crictl
    I1117 09:49:35.974659 2006 checks.go:370] validating the presence of executable conntrack
    I1117 09:49:35.974666 2006 checks.go:370] validating the presence of executable ip
    I1117 09:49:35.974674 2006 checks.go:370] validating the presence of executable iptables
    I1117 09:49:35.974682 2006 checks.go:370] validating the presence of executable mount
    I1117 09:49:35.974689 2006 checks.go:370] validating the presence of executable nsenter
    I1117 09:49:35.974698 2006 checks.go:370] validating the presence of executable ebtables
    I1117 09:49:35.974707 2006 checks.go:370] validating the presence of executable ethtool
    I1117 09:49:35.974714 2006 checks.go:370] validating the presence of executable socat
    I1117 09:49:35.974720 2006 checks.go:370] validating the presence of executable tc
    I1117 09:49:35.974725 2006 checks.go:370] validating the presence of executable touch
    I1117 09:49:35.974750 2006 checks.go:516] running all checks
    [WARNING SystemVerification]: missing optional cgroups: blkio
    I1117 09:49:35.983005 2006 checks.go:401] checking whether the given node name is valid and reachable using net.LookupHost
    I1117 09:49:35.984761 2006 checks.go:610] validating kubelet version
    I1117 09:49:36.030854 2006 checks.go:130] validating if the "kubelet" service is enabled and active
    I1117 09:49:36.038685 2006 checks.go:203] validating availability of port 10250
    I1117 09:49:36.038781 2006 checks.go:280] validating the existence of file /etc/kubernetes/pki/ca.crt
    I1117 09:49:36.038789 2006 checks.go:430] validating if the connectivity type is via proxy or direct
    I1117 09:49:36.038821 2006 join.go:533] [preflight] Discovering cluster-info
    I1117 09:49:36.038862 2006 token.go:80] [discovery] Created cluster-info discovery client, requesting info from "192.168.10.128:6443"
    I1117 09:49:36.050731 2006 token.go:118] [discovery] Requesting info from "192.168.10.128:6443" again to validate TLS against the pinned public key
    I1117 09:49:36.054719 2006 token.go:135] [discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server "192.168.10.128:6443"
    I1117 09:49:36.054738 2006 discovery.go:52] [discovery] Using provided TLSBootstrapToken as authentication credentials for the join process
    I1117 09:49:36.054743 2006 join.go:547] [preflight] Fetching init configuration
    I1117 09:49:36.054747 2006 join.go:593] [preflight] Retrieving KubeConfig objects
    [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'
    I1117 09:49:36.057469 2006 kubelet.go:74] attempting to download the KubeletConfiguration from ConfigMap "kubelet-config"
    I1117 09:49:36.059173 2006 interface.go:432] Looking for default routes with IPv4 addresses
    I1117 09:49:36.059196 2006 interface.go:437] Default route transits interface "ens160"
    I1117 09:49:36.059274 2006 interface.go:209] Interface ens160 is up
    I1117 09:49:36.059298 2006 interface.go:257] Interface "ens160" has 2 addresses :[192.168.10.129/24 fe80::b87b:4a27:cd99:16ee/64].
    I1117 09:49:36.059309 2006 interface.go:224] Checking addr 192.168.10.129/24.
    I1117 09:49:36.059313 2006 interface.go:231] IP found 192.168.10.129
    I1117 09:49:36.059316 2006 interface.go:263] Found valid IPv4 address 192.168.10.129 for interface "ens160".
    I1117 09:49:36.059320 2006 interface.go:443] Found active IP 192.168.10.129
    I1117 09:49:36.062265 2006 preflight.go:103] [preflight] Running configuration dependant checks
    I1117 09:49:36.062285 2006 controlplaneprepare.go:220] [download-certs] Skipping certs download
    I1117 09:49:36.062290 2006 kubelet.go:120] [kubelet-start] writing bootstrap kubelet config file at /etc/kubernetes/bootstrap-kubelet.conf
    I1117 09:49:36.062705 2006 kubelet.go:135] [kubelet-start] writing CA certificate at /etc/kubernetes/pki/ca.crt
    I1117 09:49:36.062997 2006 kubelet.go:156] [kubelet-start] Checking for an existing Node in the cluster with name "ubuntu2204-worker" and status "Ready"
    I1117 09:49:36.066958 2006 kubelet.go:171] [kubelet-start] Stopping the kubelet
    [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...
    I1117 09:49:41.283287 2006 cert_rotation.go:137] Starting client certificate rotation controller
    I1117 09:49:41.285117 2006 kubelet.go:219] [kubelet-start] preserving the crisocket information for the node
    I1117 09:49:41.285176 2006 patchnode.go:31] [patchnode] Uploading the CRI Socket information "unix:///var/run/containerd/containerd.sock" to the Node API object "ubuntu2204-worker" as an annotation

    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.

    root@ubuntu2204-worker:~#

    最后,如果想在 節(jié)點(diǎn)上運(yùn)行 命令,需要將 節(jié)點(diǎn)上的~/.kube/復(fù)制過(guò)來(lái),然后便可以運(yùn)行以下命令查看節(jié)點(diǎn)信息:

    kubectl get nodes

    小結(jié)

    相信通過(guò)這些步驟,大家開(kāi)始能體會(huì)到其內(nèi)部的復(fù)雜度了,確實(shí)不亞于安裝一個(gè)操作系統(tǒng)。筆者這里只貼出了主要的執(zhí)行步驟,其實(shí)還有很多可選操作,比如 , 等,將來(lái)有機(jī)會(huì),筆者會(huì)在其他文章中進(jìn)行補(bǔ)充。

    不過(guò),話又說(shuō)回來(lái),這么復(fù)雜的東西都是由計(jì)算機(jī)基礎(chǔ)知識(shí)構(gòu)建起來(lái)的,比如計(jì)算機(jī)網(wǎng)絡(luò)、操作系統(tǒng)等。正如一座龐大的建筑是由一磚一瓦搭起來(lái)的計(jì)算機(jī)中集群是什么意思,而這一磚一瓦就是基本功。所以,構(gòu)建基本功是每個(gè)計(jì)算機(jī)工程師、架構(gòu)師不可或缺的能力。

    寫(xiě)到這里,突然想起一句話:所謂才華,就是基本功的溢出。

    [1]

    [2]

    [3]

    [4]#---and-

    [5]

    [6]

    [7] 這里只是為了學(xué)習(xí),所以將污點(diǎn)移除,生產(chǎn)環(huán)境不建議移除。另外,我們可以在部署業(yè)務(wù)時(shí),在 Pod 里設(shè)置 來(lái)“容忍”某些“污點(diǎn)”,也能達(dá)到相同的效果。

    [8] 在 1.24 之前, 使用node-role..io/:來(lái)表示不被調(diào)度的污點(diǎn),之后便調(diào)整成了node-role..io/-plane:。

網(wǎng)站首頁(yè)   |    關(guān)于我們   |    公司新聞   |    產(chǎn)品方案   |    用戶案例   |    售后服務(wù)   |    合作伙伴   |    人才招聘   |   

友情鏈接: 餐飲加盟

地址:北京市海淀區(qū)    電話:010-     郵箱:@126.com

備案號(hào):冀ICP備2024067069號(hào)-3 北京科技有限公司版權(quán)所有