站長資訊網
        最全最豐富的資訊網站

        kubeadm快速搭建k8s集群

        環境

        master01:192.168.1.110 (最少2核CPU)

        node01:192.168.1.100

        規劃

        services網絡:10.96.0.0/12

        pod網絡:10.244.0.0/16

         

        1.配置hosts解析各主機

        vim /etc/hosts

        127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
        ::1        localhost localhost.localdomain localhost6 localhost6.localdomain6
        192.168.1.110 master01
        192.168.1.100 node01

        2.同步各主機時間

        yum install -y ntpdate
        ntpdate time.windows.com

        14 Mar 16:51:32 ntpdate[46363]: adjust time server 13.65.88.161 offset -0.001108 sec

        3.關閉SWAP,關閉selinux

        swapoff -a

         

        vim /etc/selinux/config

        # This file controls the state of SELinux on the system.
        # SELINUX= can take one of these three values:
        #    enforcing – SELinux security policy is enforced.
        #    permissive – SELinux prints warnings instead of enforcing.
        #    disabled – No SELinux policy is loaded.
        SELINUX=disabled

         

        4.安裝docker-ce

        yum install -y yum-utils device-mapper-persistent-data lvm2
        yum-config-manager –add-repo http://mirrors.aliyun.com/docker-ce/linux/CentOS/docker-ce.repo
        yum makecache fast
        yum -y install docker-ce

        Docker 安裝后出現:WARNING: bridge-nf-call-iptables is disabled 的解決辦法

         

        vim /etc/sysctl.conf

        # sysctl settings are defined through files in
        # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
        #
        # Vendors settings live in /usr/lib/sysctl.d/.
        # To override a whole file, create a new file with the same in
        # /etc/sysctl.d/ and put new settings there. To override
        # only specific settings, add a file with a lexically later
        # name in /etc/sysctl.d/ and put new settings there.
        #
        # For more information, see sysctl.conf(5) and sysctl.d(5).
        net.bridge.bridge-nf-call-ip6tables=1
        net.bridge.bridge-nf-call-iptables=1
        net.bridge.bridge-nf-call-arptables=1

         

        systemctl enable docker && systemctl start docker

        5.安裝kubernetes

         

        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
        setenforce 0
        yum install -y kubelet kubeadm kubectl
        systemctl enable kubelet && systemctl start kubelet

         

        6.初始化集群

        kubeadm init –image-repository registry.aliyuncs.com/google_containers –kubernetes-version v1.13.1 –pod-network-cidr=10.244.0.0/16

         

        Your Kubernetes master 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/

        You can now join any number of machines by running the following on each node
        as root:

          kubeadm join 192.168.1.110:6443 –token wgrs62.vy0trlpuwtm5jd75 –discovery-token-ca-cert-hash sha256:6e947e63b176acf976899483d41148609a6e109067ed6970b9fbca8d9261c8d0

         

        7.手動部署flannel

        flannel網址:https://github.com/coreos/flannel

        for Kubernetes v1.7+

        kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

         

        podsecuritypolicy.extensions/psp.flannel.unprivileged created
        clusterrole.rbac.authorization.k8s.io/flannel created
        clusterrolebinding.rbac.authorization.k8s.io/flannel created
        serviceaccount/flannel created
        configmap/kube-flannel-cfg created
        daemonset.extensions/kube-flannel-ds-amd64 created
        daemonset.extensions/kube-flannel-ds-arm64 created
        daemonset.extensions/kube-flannel-ds-arm created
        daemonset.extensions/kube-flannel-ds-ppc64le created
        daemonset.extensions/kube-flannel-ds-s390x created

         

        8.node配置

        安裝docker kubelet kubeadm

        docker安裝同步驟4,kubelet kubeadm安裝同步驟5

        9.node加入到master

        kubeadm join 192.168.1.110:6443 –token wgrs62.vy0trlpuwtm5jd75 –discovery-token-ca-cert-hash sha256:6e947e63b176acf976899483d41148609a6e109067ed6970b9fbca8d9261c8d0

        kubectl get nodes  #查看node狀態

        NAME                    STATUS    ROLES    AGE    VERSION
        localhost.localdomain  NotReady  <none>  130m    v1.13.4
        master01                Ready      master  4h47m  v1.13.4
        node01                  Ready      <none>  94m    v1.13.4

        kubectl get cs  #查看組件狀態

        NAME                STATUS    MESSAGE              ERROR
        scheduler            Healthy  ok                 
        controller-manager  Healthy  ok                 
        etcd-0              Healthy  {“health”: “true”} 

        kubectl get ns  #查看名稱空間

        NAME          STATUS  AGE
        default      Active  4h41m
        kube-public  Active  4h41m
        kube-system  Active  4h41m

         

        kubectl get pods -n kube-system  #查看pod狀態

        NAME                              READY  STATUS    RESTARTS  AGE
        coredns-78d4cf999f-bszbk          1/1    Running  0          4h44m
        coredns-78d4cf999f-j68hb          1/1    Running  0          4h44m
        etcd-master01                      1/1    Running  0          4h43m
        kube-apiserver-master01            1/1    Running  1          4h43m
        kube-controller-manager-master01  1/1    Running  2          4h43m
        kube-flannel-ds-amd64-27×59        1/1    Running  1          126m
        kube-flannel-ds-amd64-5sxgk        1/1    Running  0          140m
        kube-flannel-ds-amd64-xvrbw        1/1    Running  0          91m
        kube-proxy-4pbdf                  1/1    Running  0          91m
        kube-proxy-9fmrl                  1/1    Running  0          4h44m
        kube-proxy-nwkl9                  1/1    Running  0          126m
        kube-scheduler-master01            1/1    Running  2          4h43m

        贊(0)
        分享到: 更多 (0)
        網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號
        主站蜘蛛池模板: 亚洲精品午夜无码电影网| 久久亚洲欧美国产精品| 亚洲国产精品久久久天堂| 国产精品 码ls字幕影视| 精品人妻大屁股白浆无码| 久久综合精品国产一区二区三区| 久久91精品国产91久久小草| 精品无码久久久久国产| 亚洲欧美精品午睡沙发| 毛片a精品**国产| 国产在线国偷精品免费看| 99re6在线视频精品免费| 国产欧美日韩综合精品一区二区三区 | 全球AV集中精品导航福利| 国产精品制服丝袜亚洲欧美| 国产成人精品福利网站在线| 亚洲国产另类久久久精品黑人 | 欧美国产日韩精品| 国产精品日本一区二区不卡视频| 中文字幕av日韩精品一区二区| 久久久久99精品成人片牛牛影视| 国产精品第1页| 国产亚洲精品激情都市| 国产免费伦精品一区二区三区 | 久久久精品人妻无码专区不卡| 欧美日韩精品久久久久| 无码日韩人妻精品久久蜜桃 | 国产精品亚洲视频| 国产偷亚洲偷欧美偷精品| 99re6这里有精品热视频| 人人妻人人澡人人爽欧美精品| 麻豆精品视频在线观看91| 久久久精品一区二区三区| 国产一区二区三区欧美精品| 永久免费精品视频| 精品在线免费观看| 欧美国产日本精品一区二区三区 | 国产成人精品福利网站在线| 91精品国产福利在线导航| 国产精品一区二区久久| 精品九九人人做人人爱|