zoukankan      html  css  js  c++  java
  • 一,kubeadm初始化k8s集群

    docker安装

    wget    https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo

    yum install -y docker-ce

    systemctl start docker
    systemctl enable docker

    一:配置hosts文件

    cat /etc/hosts

    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.0.3 xiaolizi

    二:配置内核参数

    创建/etc/sysctl.d/k8s.conf文件,添加如下内容:

    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    net.ipv4.ip_forward = 1

    执行命令使修改生效。

    sysctl -p /etc/sysctl.d/k8s.conf

    三:关闭防火墙和selinux

    systemctl stop firewalld && systemctl disable firewalld

    setenforce 0

    sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config && setenforce 0

    四:配置k8s仓库

    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

    五:安装kubelet

    yum install -y kubelet kubeadm kubectl
    systemctl enable kubelet && systemctl start kubelet

    六:初始化

    kubeadm init --apiserver-advertise-address=192.168.0.3 --image-repository registry.aliyuncs.com/google_containers
    --kubernetes-version v1.17.0 --pod-network-cidr=192.168.0.0/16

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

    kubectl taint nodes --all node-role.kubernetes.io/master-

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

    七:查看

  • 相关阅读:
    loadrunner下检查点乱码情况处理
    Linux下安装loadrunner步骤及遇到的问题
    当你决定不再在乎的时候,生活就好起来了
    受难语录
    LoadRunner--内存指标介绍
    Microsoft Visual Studio Web 创作组件安装失败的解决方法
    (六)微服务分布式云架构spring cloud
    (五)微服务分布式云架构
    (四)微服务分布式云架构
    (三)微服务分布式云架构
  • 原文地址:https://www.cnblogs.com/jianlilistu/p/12122029.html
Copyright © 2011-2022 走看看