zoukankan      html  css  js  c++  java
  • kubernetes集群搭建(4):node节点安装

    下列所有操作需要在所有node节点上操作,并注意红色部分的修改

    1.node节点不需要安装etcd来存储相关信息

    yum -y install flannel kubernetes

    2.修改flanneld网络相关信息 

    [root@k8s-node1 ~]# vi  /etc/sysconfig/flanneld 
    
    # Flanneld configuration options
    FLANNEL_ETCD="http://k8s-master:2379"
    # etcd url location.  Point this to the server where etcd runs
    FLANNEL_ETCD_ENDPOINTS="http://k8s-master:2379"
    
    # etcd config key.  This is the configuration key that flannel queries
    # For address range assignment
    FLANNEL_ETCD_PREFIX="/atomic.io/network"
    
    # Any additional options that you want to pass
    #FLANNEL_OPTIONS=""

    注意: /atomic.io/network 需与  master配置第7步中配置 etcdctl mk /atomic.io/network/config '{"Network":"172.16.0.0/16"}' 名称一致

    3.kubelet config信息

    [root@k8s-node1 ~]# vi /etc/kubernetes/config 
    
    ###
    # kubernetes system config
    #
    # The following values are used to configure various aspects of all
    # kubernetes services, including
    #
    #   kube-apiserver.service
    #   kube-controller-manager.service
    #   kube-scheduler.service
    #   kubelet.service
    #   kube-proxy.service
    # logging to stderr means we get it in the systemd journal
    KUBE_LOGTOSTDERR="--logtostderr=true"
    
    # journal message level, 0 is debug
    KUBE_LOG_LEVEL="--v=0"
    
    # Should this cluster be allowed to run privileged docker containers
    KUBE_ALLOW_PRIV="--allow-privileged=false"
    
    # How the controller-manager, scheduler, and proxy find the apiserver
    KUBE_MASTER="--master=http://k8s-master:8080"

    4.kubelet 核心文件修改

    [root@k8s-node1 ~]# vi /etc/kubernetes/kubelet 
    
    # The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
    KUBELET_ADDRESS="--address=0.0.0.0"
    
    # The port for the info server to serve on
    KUBELET_PORT="--port=10250"
    
    # You may leave this blank to use the actual hostname
    KUBELET_HOSTNAME="--hostname-override=k8s-node1"
    
    # location of the api-server
    KUBELET_API_SERVER="--api-servers=http://k8s-master:8080"
    
    # pod infrastructure container
    KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=192.168.100.6:5000/rhel7/pod-infrastructure:1.0"
    
    KUBELET_ARGS="--cluster-dns=10.254.0.2 --cluster-domain=cluster.local"

    注意:修改 KUBELET_HOSTNAME 中节点信息,KUBELET_POD_INFRA_CONTAINER 对应到私库地址 , KUBELET_ARGS 配置的为dns解析信息 和master配置第4步 配置一致

    5.启动服务

    for SERVICES in kube-proxy kubelet flanneld; do
        systemctl restart $SERVICES
        systemctl enable $SERVICES
        systemctl status $SERVICES 
    done

    6.在master节点上测试配置是否成功。如果看到红色信息,表示环境搭建成功

    [root@k8s-master ~]# kubectl get nodes
    NAME        STATUS    AGE
    k8s-node1   Ready     11d
    k8s-node2   Ready     11d
    [root@k8s-master ~]# 
  • 相关阅读:
    108. Convert Sorted Array to Binary Search Tree
    How to check if one path is a child of another path?
    Why there is two completely different version of Reverse for List and IEnumerable?
    在Jenkins中集成Sonarqube
    如何查看sonarqube的版本 how to check the version of sonarqube
    Queue
    BFS广度优先 vs DFS深度优先 for Binary Tree
    Depth-first search and Breadth-first search 深度优先搜索和广度优先搜索
    102. Binary Tree Level Order Traversal 广度优先遍历
    How do I check if a type is a subtype OR the type of an object?
  • 原文地址:https://www.cnblogs.com/xiaochangwei/p/kubernetes-04.html
Copyright © 2011-2022 走看看