• k8s记录-flanneld+docker网络部署(四)


    1)程序准备
    tar xvf flannel-v0.10.0-linux-amd64.tar.gz
    mkdir -p /data/projects/common/kubernetes/{bin,cfg,ssl}
    mv flanneld mk-docker-opts.sh kubernetes/bin
    以下步骤每一台机器部署注意名称、IP、路径等修改(脚本文件、配置文件)
    2)修改配置
    flanneld

    #!/bin/bash
    ETCD_HOME=etcd
    ETCD01_IP=192.168.0.1
    ETCD02_IP=192.168.0.2
    ETCD03_IP=192.168.0.3
    
    FLANNEL_OPTIONS="--etcd-endpoints=https://$ETCD01_IP:2379,https://$ETCD02_IP:2379,https://$ETCD03_IP:2379  -etcd-cafile=$ETCD_HOME/ssl/ca.pem -etcd-certfile=$ETCD_HOME/ssl/server.pem -etcd-keyfile=$ETCD_HOME/ssl/server-key.pem"

    3)开启与停止服务
    a.开启服务

    #/bin/bash
    KUBE_HOME=kubernetes
    
    source $KUBE_HOME/cfg/flanneld
    sudo nohup $KUBE_HOME/bin/flanneld $FLANNEL_OPTIONS &
    sudo $KUBE_HOME/bin/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker 

    b.停止服务

    #/bin/bash
    kill -9 ` ps -ef | grep flanneld | grep -v grep | awk '{print $2}'`


    4)配置docker

    #!/bin/bash
    cdir="/app/docker"
    mkdir -p $cdir
    cd /app/docker
    yum -y install libtool-ltdl-devel policycoreutils policycoreutils-python libseccomp pigz container-selinux
    rpm -ivh docker-ce-cli-18.09.0-3.el7.x86_64.rpm
    rpm -ivh docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
    rpm -ivh containerd.io-1.2.0-3.el7.x86_64.rpm
    rpm -ivh docker-ce-18.09.0-3.el7.x86_64.rpm
    systemctl start docker
    sleep 5
    systemctl stop docker
    sleep 5
    mv /var/lib/docker/* /data/docker
    cd /var/lib
    rm -rf docker
    ln -s /data/docker /var/lib/docker
    ls -l docker
    systemctl start docker
    usermod -G docker app 
    systemctl restart docker.service
    docker ps –a
    cp docker-compose /usr/local/bin
    chmod +x /usr/local/bin/docker-compose

    修改docker.service
    在usr/lib/systemd/system/docker.service“ExecStart”上方加入(注释原来的)
    EnvironmentFile=/run/flannel/docker
    ExecStart=/usr/bin/dockerd $DOCKER_NETWORK_OPTIONS

    systemctl daemon-reload

    systemctl restart docker

    #验证docker0和flanneld1.1是否在同一网段执行ifconfig

  • 相关阅读:
    深拷贝浅拷贝
    计算属性和监听,computed,watch
    字面量的引用与使用
    MYSQL 触发器
    JavaScript寻找对象方式
    JavaScript事件传播
    HTML 绑定事件
    JavaScript 中的 String()方法
    JavScript re模块
    JavScript Math函数的使用方法
  • 原文地址:https://www.cnblogs.com/xinfang520/p/11608940.html
Copyright © 2020-2023  润新知