美文网首页K8s
在openEuler上部署Kubernetes

在openEuler上部署Kubernetes

作者: interboy | 来源:发表于2022-07-26 17:04 被阅读0次

    在Master节点部署(需要内存2G,CPU 2Core)

    dnf install -y docker
    dnf install -y kubernetes-kubeadm kubernetes-kubelet kubernetes-master

    mkdir -p /opt/cni/bin
    cp /usr/libexec/cni/* /opt/cni/bin/

    永久关闭Swap分区,编辑配置
    vi /etc/fstab
    注释掉swap所在行

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

    重启系统
    systemctl reboot

    或者临时关闭swap分区
    swapoff -a

    systemctl stop firewalld && systemctl disable firewalld
    systemctl enable docker && systemctl start docker
    systemctl enable kubelet.service && systemctl start kubelet.service

    dnf install -y conntrack
    dnf install -y containernetworking-plugins containernetworking-plugins-devel

    kubeadm init
    --apiserver-advertise-address=192.168.26.110 \ 修改IP地址
    --image-repository registry.aliyuncs.com/google_containers
    --kubernetes-version v1.15.0
    --service-cidr=10.1.0.0/16
    --pod-network-cidr=10.244.0.0/16

    配置变量
    vi /etc/profile
    在文件底部追加
    export KUBECONFIG=/etc/kubernetes/admin.conf
    应用改变
    source /etc/profile

    查看master节点状态
    kubectl get nodes

    如果NotReady通过下面命令查看错误原因
    journalctl -u kubelet -f

    解决cni错误
    docker pull lizhenliang/flannel:v0.11.0-amd64
    下载yaml文件
    kubectl apply -f kube-flannel.yml

    再次查看master节点状态
    kubectl get nodes

    在Node节点部署

    dnf install -y docker
    dnf install -y kubernetes-kubeadm kubernetes-kubelet kubernetes-node containernetworking-plugins containernetworking-plugins-devel

    mkdir -p /opt/cni/bin
    cp /usr/libexec/cni/* /opt/cni/bin/
    swapoff -a
    systemctl stop firewalld && systemctl disable firewalld
    systemctl enable docker && systemctl start docker
    systemctl enable kubelet.service && systemctl start kubelet.service

    docker pull lizhenliang/flannel:v0.11.0-amd64

    依据Master节点上创建的token开始join命令,此处可以从kubeadm init的返回中复制。
    kubeadm join 192.168.26.110:6443 --token m9oddn.y7dl6juvxssdjv2e --discovery-token-ca-cert-hash sha256:5625631f862988897bda2d7a26a7dc2e40eb4d8ad6fc93556b4d3ed3bcbece3d

    相关文章

      网友评论

        本文标题:在openEuler上部署Kubernetes

        本文链接:https://www.haomeiwen.com/subject/crvoirtx.html