• k8s安装


    1.准备三个节点
    192.168.1.188 centos01
    192.168.1.189 centos02
    192.168.1.190 centos03

    2.关闭防火墙
    systemctl stop firewalld

    3.关闭selinux
    setenforce 0

    4.关闭swap
    swapoff -a
    or vim /etc/fstab ,注释掉swap挂载这一行可以永久关闭swap分区

    5.添加本地映射
    vim /etc/hosts
    192.168.1.188 centos01
    192.168.1.189 centos02
    192.168.1.190 centos03

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

    7.安装docker
    修改Cgroupfs 为 Systemd(docker文件驱动默认由cgroupfs 改成 systemd,与k8s保持一致避免conflict):
    vim /etc/docker/daemon.json

    {
    "exec-opts": ["native.cgroupdriver=systemd"]
    }

    8.开机启动&启动
    systemctl enable docker
    systemctl start docker

    9.Kubernetes yum源配置
    vim /etc/yum.repos.d/kubernetes.repo
    [kubernetes]
    name=Kubernetes Repo
    baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
    gpgcheck=0
    enabled=1

    10.安装k8s
    yum install -y docker-ce kubelet kubeadm kubectl --nobest

    11.开机启动&启动
    systemctl enable kubelet
    systemctl start kubelet

    主节点配置:
    12.master部署
    kubeadm init --kubernetes-version=1.18.4 --apiserver-advertise-address=192.168.1.188 --image-repository registry.aliyuncs.com/google_containers --service-cidr=10.10.0.0/16 --pod-network-cidr=10.244.0.0/16

    13.创建配置文件
    mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config

    14.修改访问端口
    由于kube-apiserver默认只启动安全访问接口6443,而不启动非安装访问接口8080,kubectl是通过8080端口访问k8s kubelet的,所以要修改配置文件,使其支持8080端口访问:

    vim /etc/kubernetes/manifests/kube-apiserver.yaml
    把–insecure-port=0修改为:
    –insecure-port=8080
    保存后等待一会。

    15.安装calico网络
    kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

    16.calicao网络安装好后
    kubectl get node
    可以看到master节点已经ready

    从节点配置
    17.slave加入集群
    kubeadm join 192.168.1.188:6443 --token edl5gc.cyzmv8rl5422hxp0
    --discovery-token-ca-cert-hash sha256:db55cd0325136c384dc74503300abc17e3acd6d8a14d31d24e8d71791cd139ab

  • 相关阅读:
    【noi2018】归程
    【USACO06JAN】牛的舞会The Cow Prom
    City Horizon (线段树)
    USACO 2019 January Gold Cow Poetry (结论+dp)
    POJ 2528 Mayor's posters (线段树)
    线段覆盖 (线段树)
    POJ 2892 Tunnel Warfare (线段树)
    NOIP 2017 逛公园 (最短路+dp)
    USACO 2019 February Gold Cow Land (树链剖分)
    CSU 2151 集训难度(线段树)
  • 原文地址:https://www.cnblogs.com/xu-xiaofeng/p/13580393.html
Copyright © 2020-2023  润新知