标签:pre level ssi miss lease flannel dock namespace atomic
一、kubernetes组件和角色分布- etcd 一个高可用的K/V键值对存储和服务发现系统
- flannel 实现夸主机的容器网络的通信
- kube-apiserver 提供kubernetes集群的API调用
- kube-controller-manager 确保集群服务
- kube-scheduler 调度容器,分配到Node
- kubelet 在Node节点上按照配置文件中定义的容器规格启动容器
- kube-proxy 提供网络代理服务
主机 | 角色 |
---|---|
192.168.10.131 | etcd server、kubernetes master |
192.168.10.128 | kubernetes node |
192.168.10.135 | kubernetes node |
# yum -y install epel-release
1.在master上安装etcd和kubernetes-master
[root@dockertest ~]# yum -y install etcd kubernetes-master
2.修改etcd配置文件
[root@dockertest ~]# cat /etc/etcd/etcd.conf | grep -v "^#"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_NAME="default"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
3.修改kubernetes配置文件
[root@dockertest ~]# cat /etc/kubernetes/apiserver | grep -v "^#" | grep -v "^$"
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,ServiceAccount,ResourceQuota"
KUBE_API_ARGS=""
4.设置服务启动
[root@dockertest ~]# for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES ; done
5.在etcd中定义flannel网络
[root@dockertest ~]# etcdctl mk /atomic.io/network/config ‘{"Network":"172.17.0.0/16"}‘
{"Network":"172.17.0.0/16"}
1..在所有node节点上安装flannel和kubernetes-node
[root@machine1 ~]# yum -y install flannel kubernetes-node
2.修改flannel配置文件
[root@machine1 ~]# cat /etc/sysconfig/flanneld | grep -v "^#" | grep -v "^$"
FLANNEL_ETCD_ENDPOINTS="http://192.168.10.131:2379"
FLANNEL_ETCD_PREFIX="/atomic.io/network"
3.修改kubernetes配置文件
[root@machine2 ~]# cat /etc/kubernetes/config | grep -v "^#" | grep -v "^$"
KUBE_LOGTOSTDERR="--logtostderr=true"
KUBE_LOG_LEVEL="--v=0"
KUBE_ALLOW_PRIV="--allow-privileged=false"
KUBE_MASTER="--master=http://192.168.10.131:8080"
[root@machine1 ~]# cat /etc/kubernetes/kubelet| grep -v "^#" | grep -v "^$"
KUBELET_ADDRESS="--address=0.0.0.0"
KUBELET_PORT="--port=10250"
KUBELET_HOSTNAME="--hostname-override=192.168.10.128"
KUBELET_API_SERVER="--api-servers=http://192.168.10.131:8080" #修改成对应Node的IP
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""
4.启动kube-proxy,kubelet,docker,flanneld等服务
[root@machine2 ~]# for SERVICES in kube-proxy kubelet docker flanneld;do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES; done
[root@dockertest ~]# kubectl get node
NAME STATUS AGE
192.168.10.128 Ready 1m
192.168.10.135 Ready 1m
标签:pre level ssi miss lease flannel dock namespace atomic
原文地址:http://blog.51cto.com/lullaby/2147812