• (二)k8-集群创建


    主机名操作系统版本ipdocker versionkubelet versionkubctl versionflannel version
    kmasterCentOS Linux release 7.4.1708 (Core)10.10.130.8118.09.6v1.14.0v1.14.00.19.0
    knode01CentOS Linux release 7.4.1708 (Core)10.10.130.8218.09.6v1.14.0v1.14.00.19.0
    knode02CentOS Linux release 7.4.1708 (Core)10.10.130.8318.09.6v1.14.0v1.14.00.19.0

    master 节点

    1. 初始化
      kubeadm init --apiserver-advertise-address 10.10.130.81 --pod-network-cidr=10.244.0.0/16
    2. 加载环境变量
      cat ~/.bashrc
    export KUBECONFIG=/etc/kubernetes/admin.conf
    
    • 1

    flannel

    1. 拉取镜像
      docker pull quay.io/coreos/flannel:v0.11.0-amd64
    2. 配置文件
      mkdir -p /etc/cni/net.d/
      cat /etc/cni/net.d/10-flannel.conf
    {"name":"cbr0","type":"flannel","delegate": {"isDefaultGateway": true}}
    
    • 1

    mkdir /usr/share/oci-umount/oci-umount.d -p
    mkdir /run/flannel/
    cat /run/flannel/subnet.env

    FLANNEL_NETWORK=10.244.0.0/16
    FLANNEL_SUBNET=10.244.0.1/24
    FLANNEL_MTU=1450
    FLANNEL_IPMASQ=true
    
    • 1
    • 2
    • 3
    • 4
    1. 部署
      kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

    node节点

    1. master节点添加token
      kubeadm token create --print-join-command
    2. node节点添加
      kubeadm join 10.10.130.81:6443 --token o00vfm.pbmf2r0h1jzcd74k --discovery-token-ca-cert-hash sha256:8fce5546e26d95a047b31dcaf5812402b4805da04420cfe1f8ab15ac2ac383e9
    3. flannel配置文件
      mkdir -p /etc/cni/net.d/
      cat /etc/cni/net.d/10-flannel.conf
    {"name":"cbr0","type":"flannel","delegate": {"isDefaultGateway": true}}
    
    • 1

    mkdir /usr/share/oci-umount/oci-umount.d -p
    mkdir /run/flannel/
    cat /run/flannel/subnet.env

    FLANNEL_NETWORK=10.244.0.0/16
    FLANNEL_SUBNET=10.244.0.1/24
    FLANNEL_MTU=1450
    FLANNEL_IPMASQ=true
    
    • 1
    • 2
    • 3
    • 4
  • 相关阅读:
    新公司第一次上架新APP需要提前准备哪些材料?
    windows TBB的使用
    长沙建筑模板生产厂家有哪些?
    磁盘的工作方式
    应用软件安全保证措施方案书
    Linux 安装ssh和配置ssh
    6. 堪比JMeter的.Net压测工具 - Crank 实战篇 - 收集诊断跟踪信息与如何分析瓶颈
    MaxCompute实例相关操作
    域内创建机器用户
    Linux rpm命令详解
  • 原文地址:https://blog.csdn.net/qq_25562325/article/details/126241707