zoukankan      html  css  js  c++  java
  • yum方式安装kubernetes

    环境准备 master01 node01 node02,连通网络,修改hosts文件,确认3台主机相互解析

    vim /etc/hosts
    
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.1.201 master01
    192.168.1.202 node01
    192.168.1.203 node02

    主机配置阿里YUM源

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup && curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

    开始部署kubernetes

    1.在master01安装etcd

    yum install etcd -y

    安装完成,修改etcd配置文件/etc/etcd/etcd.conf

    vim /etc/etcd/etcd.conf
    
    ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"    #修改监听地址
    ETCD_LISTEN_CLIENT_URLS="http://192.168.1.201:2379"    #修改etcd地址为本机地址

    设置服务启动

    systemctl start etcd && systemctl enable etcd

    2.在所有主机安装kubernetes

    yum install kubernetes -y

    3.配置master

    vim /etc/kubernetes/config
    
    KUBE_MASTER="--master=http://192.168.1.201:8080"    #修改kube_master地址
    vim /etc/kubernetes/apiserver
    
    KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"    #修改监听地址
    KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.1.201:2379"    #修改etcd地址
    KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"    #删除认证参数ServiceAccount

    设置服务启动,启动顺序apiserver>scheduler=controller-manager

    systemctl start docker && systemctl enable docker
    systemctl start kube-apiserver && systemctl enable kube-apiserver
    systemctl start kube-scheduler && systemctl enable kube-scheduler
    systemctl start kube-controller-manager && systemctl enable kube-controller-manager

    4.配置node

    vim /etc/kubernetes/config
    
    KUBE_MASTER="--master=http://192.168.1.201:8080"    #修改master地址
    vim /etc/kubernetes/kubelet
    
    KUBELET_ADDRESS="--address=192.168.1.202"    #修改kubelet地址
    KUBELET_HOSTNAME="--hostname-override=192.168.1.202"    #修改kubelet主机名
    KUBELET_API_SERVER="--api-servers=http://192.168.1.201:8080"    #修改apiserver地址

    设置服务启动

    systemctl start docker && systemctl enable docker
    systemctl start kubelet && systemctl enable kubelet
    systemctl start kube-proxy && systemctl enable kube-proxy

    5.部署完成,查看集群状态

    kubectl get nodes
    [root@node02 kubernetes]# kubectl -s http://192.168.1.201:8080 get nodes -o wide
    NAME            STATUS    AGE       EXTERNAL-IP
    192.168.1.202   Ready     29s       <none>
    192.168.1.203   Ready     16m       <none>

     6.在所有主机安装flannel

    yum install flannel -y
    vim /etc/sysconfig/flanneld
    
    FLANNEL_ETCD_ENDPOINTS="http://192.168.1.201:2379"    #修改etcd地址
    etcdctl mk /atomic.io/network/config '{ "Network": "172.16.0.0/16" }'    #在etcd主机设置容器网络

    master主机重启服务

    systemctl start flanneld && systemctl enable flanneld
    systemctl restart docker
    systemctl restart kube-apiserver
    systemctl restart kube-scheduler
    systemctl restart kube-controller-manager

    node主机重启服务

    systemctl start flanneld && systemctl enable flanneld
    systemctl restart docker
    systemctl restart kubelet
    systemctl restart kube-proxy
  • 相关阅读:
    监控微信小程序中的慢HTTP请求
    详解Vue中的虚拟DOM
    SQL Server 2005 和自增长主键identity说再见——NEWSEQUENTIALID()(转载)
    调用SqlCommand或SqlDataAdapter的Dispose方法,是否会关闭绑定的SqlConnection?(转载)
    如何取消 SqlDataAdapter.Fill() 的执行(转载)
    SQL Server备份时间段内插入的数据依旧进入了备份文件?(转载)
    何谓SQLSERVER参数嗅探(转载)
    关于T-SQL重编译那点事,WITH RECOMPILE和OPTION(RECOMPILE)区别仅仅是存储过程级重编译和SQL语句级重编译吗 (链接)
    SQL Server中,如何查看每个数据库的Owner是哪个SQL Server账户,也就是谁创建的
    SQL Server中INSERT EXEC语句不能嵌套使用(转载)
  • 原文地址:https://www.cnblogs.com/omgasw/p/10557554.html
Copyright © 2011-2022 走看看