zoukankan      html  css  js  c++  java
  • k8s-(node02加入集群)

    1、在node01执行,直接拷贝配置文件 

    #配置文件
    [root@linux-node2 ~]# scp -r  /opt/kubernetes root@192.168.56.13:/opt/
    root@192.168.56.13's password: 
    flanneld                                                                                                              100%  235   599.1KB/s   00:00    
    bootstrap.kubeconfig                                                                                                  100% 2167     4.0MB/s   00:00    
    kube-proxy.kubeconfig                                                                                                 100% 6269    11.2MB/s   00:00    
    kubelet                                                                                                               100%  377   282.0KB/s   00:00    
    kubelet.config                                                                                                        100%  267   245.6KB/s   00:00    
    kubelet.kubeconfig                                                                                                    100% 2296     1.4MB/s   00:00    
    kube-proxy                                                                                                            100%  189   143.8KB/s   00:00    
    scp: /opt//kubernetes/bin/flanneld: Text file busy
    mk-docker-opts.sh                                                                                                     100% 2139     5.1MB/s   00:00    
    kubectl                                                                                                               100%   55MB  73.3MB/s   00:00    
    kube-proxy                                                                                                            100%   48MB  70.8MB/s   00:00    
    kubelet                                                                                                               100%  169MB  89.6MB/s   00:01    
    kubelet.crt                                                                                                           100% 2185     3.0KB/s   00:00    
    kubelet.key                                                                                                           100% 1679   307.3KB/s   00:00    
    kubelet-client-2020-02-17-23-08-36.pem                                                                                100% 1273   720.8KB/s   00:00    
    kubelet-client-current.pem                                                                                            100% 1273     1.6MB/s   00:00 
    
    #启动文件
    [root@linux-node2 ~]# scp /usr/lib/systemd/system/kubelet.service /usr/lib/systemd/system/kube-proxy.service root@192.168.56.13:/usr/lib/systemd/system/root@192.168.56.13's password: 
    kubelet.service                                                                                                       100%  264   225.2KB/s   00:00    
    kube-proxy.service                                                                                                    100%  231    10.2KB/s   00:00 
    kubernetes目录、

    2、删除证书目录,启动的时候回自动创建

    [root@linux-node3 kubernetes]# rm -fr /opt/kubernetes/ssl/*
    ssl

    3、修改配置文件 kubelet、kubelet.config、kube-proxy的ip地址

    [root@linux-node3 cfg]# sed -i 's#192.168.56.12#192.168.56.13#g'  kube-proxy
    [root@linux-node3 cfg]# sed -i 's#192.168.56.12#192.168.56.13#g'  kubelet
    [root@linux-node3 cfg]# sed -i 's#192.168.56.12#192.168.56.13#g'   kubelet.config 
    View Code

    4、启动 kubelet、kube-proxy

    [root@linux-node3 cfg]# systemctl start kubelet
    [root@linux-node3 cfg]# systemctl start kube-proxy
    [root@linux-node3 cfg]# ps -ef|grep kube
    root       1881      1  0 Feb10 ?        00:03:59 /opt/kubernetes/bin/flanneld --ip-masq --etcd-endpoints=https://192.168.56.11:2379,https://192.168.56.12:2379,https://192.168.56.13:2379 -etcd-cafile=/opt/etcd/ssl/ca.pem -etcd-certfile=/opt/etcd/ssl/server.pem -etcd-keyfile=/opt/etcd/ssl/server-key.pem
    root      90471      1 11 23:45 ?        00:00:01 /opt/kubernetes/bin/kubelet --logtostderr=true --v=4 --hostname-override=192.168.56.13 --kubeconfig=/opt/kubernetes/cfg/kubelet.kubeconfig --bootstrap-kubeconfig=/opt/kubernetes/cfg/bootstrap.kubeconfig --config=/opt/kubernetes/cfg/kubelet.config --cert-dir=/opt/kubernetes/ssl --pod-infra-container-image=registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0
    root      90492      1  3 23:45 ?        00:00:00 /opt/kubernetes/bin/kube-proxy --logtostderr=true --v=4 --hostname-override=192.168.56.13 --cluster-cidr=10.0.0.0/24 --proxy-mode=ipvs --kubeconfig=/opt/kubernetes/cfg/kube-proxy.kubeconfig
    root      90627   1773  0 23:45 pts/0    00:00:00 grep --color=auto kube
    启动

    5、在master节点执行 用户授权

    [root@linux-node1 kubeconfig]#  kubectl get csr
    NAME                                                   AGE   REQUESTOR           CONDITION
    node-csr-bIE2vtpw1IAEl4TpIxVgXdmiSHtX8nNqmbaMlzXGGa4   39m   kubelet-bootstrap   Approved,Issued
    node-csr-rC1rxYz_xtQc2YZpodClGK9RDgYCR1ikw5x7t-Qv71k   59s   kubelet-bootstrap   Pending
    [root@linux-node1 kubeconfig]#  kubectl certificate approve node-csr-rC1rxYz_xtQc2YZpodClGK9RDgYCR1ikw5x7t-Qv71k
    certificatesigningrequest.certificates.k8s.io/node-csr-rC1rxYz_xtQc2YZpodClGK9RDgYCR1ikw5x7t-Qv71k approved
    [root@linux-node1 kubeconfig]#  kubectl get csr
    NAME                                                   AGE   REQUESTOR           CONDITION
    node-csr-bIE2vtpw1IAEl4TpIxVgXdmiSHtX8nNqmbaMlzXGGa4   39m   kubelet-bootstrap   Approved,Issued
    node-csr-rC1rxYz_xtQc2YZpodClGK9RDgYCR1ikw5x7t-Qv71k   71s   kubelet-bootstrap   Approved,Issued
    [root@linux-node1 kubeconfig]#  kubectl get node
    NAME            STATUS   ROLES    AGE   VERSION
    192.168.56.12   Ready    <none>   37m   v1.12.10
    192.168.56.13   Ready    <none>   14s   v1.12.10
    用户授权

     到现在单maser集群已经部署完成

  • 相关阅读:
    spring框架的jar包下载
    十四、注解(阶段三)
    十三、反射机制(阶段三)
    十二、多线程(阶段三)
    十一、I/O流(阶段三)
    十、集合类(阶段三)
    九、异常处理(阶段三)
    八、常用类(阶段三)
    IDEA安装及基本配置
    在eclipse中,用maven创建一个web项目工程
  • 原文地址:https://www.cnblogs.com/zhaojingyu/p/12322092.html
Copyright © 2011-2022 走看看