其他分享
首页 > 其他分享> > Kubernates集群搭建

Kubernates集群搭建

作者:互联网

1、Kubernates集群组件

  - etcd:在Master节点上,一个高可用的K/V键值对存储和服务发现系统

  - kube-apiserver:在Master节点上,实现跨主机的容器网络通信

  - kube-controller-manager:在Master节点上,确保集群服务

  - kube-scheduler:在Master节点上,调度容器,分配到Node节点上

  

  - kube-proxy:在Node节点上,提供网络代理服务

  - kubelet:在Node节点上,按照配置文件中定义的容器规格启动容器

  - flannel:在Node节点上,实现跨主机的容器网络的通信

2、集群示意图

3、环境安装

yum install -y epel-release
systemctl stop firewalld
systemctl disable firewalld
setenforce 0

4、安装Master节点

 

yum -y install etcd kubernetes-master
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--port=8080"
KUBELET_PORT="--kubelet-port=10250"
KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"
KUBE_API_ARGS=""
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; 
    do 
        systemctl restart $SERVICES;
        systemctl enable $SERVICES;
        systemctl status $SERVICES ; 
    done
etcdctl mk /atomic.io/network/config '{"Network":"172.17.0.0/16"}'

5、安装Node节点

yum -y install flannel kubernetes-node
FLANNEL_ETCD="http://192.168.30.20:2379"
FLANNEL_ETCD_KEY="/atomic.io/network"
KUBE_LOGTOSTDERR="--logtostderr=true"
KUBE_LOG_LEVEL="--v=0"
KUBE_ALLOW_PRIV="--allow-privileged=false"
KUBE_MASTER="--master=http://192.168.30.20:8080"

 

KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.30.21" #修改成对应Node的IP
KUBELET_API_SERVER="--api-servers=http://192.168.30.20:8080" #指定Master节点的API Server
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.30.22" 
KUBELET_API_SERVER="--api-servers=http://192.168.30.20:8080"
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.30.23"
KUBELET_API_SERVER="--api-servers=http://192.168.30.20:8080"
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.30.24"
KUBELET_API_SERVER="--api-servers=http://192.168.30.20:8080"
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""
for SERVICES in kube-proxy kubelet docker flanneld;
    do
        systemctl restart $SERVICES;
        systemctl enable $SERVICES;
        systemctl status $SERVICES;
    done

6、验证集群是否安装成功(在Master上执行)

kubectl get node

 文章来自于:韩德田Tivens-k8s入门系列之集群安装篇

标签:KUBE,0.0,192.168,KUBELET,集群,etcd,Kubernates,kube,搭建
来源: https://www.cnblogs.com/pascall/p/10499862.html