• kubernet


    kubernet

    1、关闭swap
    swapoff -a
    /etc/fstab 注释swap分区

    2、将桥接的IPv4流量传递到iptables的链
    cat > /etc/sysctl.d/k8s.conf <<EOF
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    EOF
    sysctl --system

    3、安装docker-ce
    yum install -y yum-utils device-mapper-persistent-data lvm2 iproute-tc
    yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    yum -y install docker-ce

    4、修改docker配置文件
    /etc/docker/docker.jason
    {
    "registry-mirrors": ["https://registry.docker-cn.com"],
    "exec-opts":["native.cgroupdriver=systemd"]
    }


    4、增加kubernet源

    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

    5、安装kubectl kubelet kubeadm
    dnf install kubectl kubelet kubeadm

    6、初始化kubernet
    kubeadm init --kubernetes-version=1.18.0
    --apiserver-advertise-address=10.21.101.39
    --image-repository registry.aliyuncs.com/google_containers
    --service-cidr=10.10.0.0/16 --pod-network-cidr=10.20.0.0/16


    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

    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 10.21.101.39:6443 --token hd4gc7.d5sa6bmz16ezlfib
    --discovery-token-ca-cert-hash sha256:a19b147eadb269f5b7aa5b9a4f1926f523609745530e38e0f06d4537e24eae4c

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

    source <(kubectl completion bash)

    8、安装cni
    kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml

  • 相关阅读:
    Java 判断回文字符串有多少和其中的最大字符串
    多线程下并发数据结构
    HashMap底层及使用个人理解
    简单预览课本后的疑问
    自我介绍
    HTML中行内元素与块级元素的区别:
    html基本选择符的使用
    Html简单介绍
    Sublime Text 3 快捷键精华版
    html文本的基本设置
  • 原文地址:https://www.cnblogs.com/timlong/p/13307422.html
Copyright © 2020-2023  润新知