美文网首页
centos7单机安装k8s 1.10

centos7单机安装k8s 1.10

作者: 怀旧的艾克 | 来源:发表于2019-07-25 15:50 被阅读0次

    一 禁用防火墙

    systemctl stop firewalld
    systemctl disable firewalld

    二 禁用SELINUX
    vim /etc/sysconfig/selinux

    SELINUX=disabled

    三 关闭swap内存
    swapoff -a

    四 调整内核参数
    vi /etc/sysctl.d/k8s.conf

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

    sudo sysctl --system

    五 配置yum源镜像
    vi /etc/yum.repos.d/kubernetes.repo

    [kubernetes]
    name=Kubernetes
    baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
    enabled=1
    gpgcheck=0

    vi /etc/yum.repos.d/docker.repo

    [docker-repo]
    name=Docker
    baseurl=http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7
    enabled=1
    gpgcheck=0

    开始安装

    安装并启动docker
    yum install docker
    service docker start

    下载kubernetes需要的镜像

    images=(kube-proxy-amd64:v1.10.0          
    kube-scheduler-amd64:v1.10.0          
    kube-controller-manager-amd64:v1.10.0          
    kube-apiserver-amd64:v1.10.0         
    etcd-amd64:3.1.12          
    pause-amd64:3.1         
    kubernetes-dashboard-amd64:v1.8.3          
    k8s-dns-sidecar-amd64:1.14.8          
    k8s-dns-kube-dns-amd64:1.14.8         
    k8s-dns-dnsmasq-nanny-amd64:1.14.8)
    
    for imageName in ${images[@]} ; do   
        docker pull keveon/$imageName;   
        docker tag keveon/$imageName k8s.gcr.io/$imageName;  
        docker rmi keveon/$imageName; 
    done
    

    安装kubernetes v1.10.0

    yum makecache fast 
    yum install -y kubelet-1.10.0  
    yum install -y kubeadm-1.10.0 
    yum install -y kubectl-1.10.0
    

    初始化kubernetes
    kubeadm init --kubernetes-version=v1.10.0 --pod-network-cidr=10.244.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
    

    运行master执行pod
    kubectl taint nodes --all node-role.kubernetes.io/master-

    此时节点状态为NotReady,需要安装网络插件

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

    安装完成

    相关文章

      网友评论

          本文标题:centos7单机安装k8s 1.10

          本文链接:https://www.haomeiwen.com/subject/mlyhrctx.html