[root@k8s-master ~]# systemctl start etcd
[root@k8s-master ~]# systemctl enable etcd
Created symlink from /etc/systemd/system/multi-user.target.wants/etcd.service to /usr/lib/systemd/system/etcd.service.
3.测试
[root@k8s-master ~]# etcdctl -C http://etcd:2379 cluster-health
member 8e9e05c52164694d is healthy: got healthy result from http://10.173.32.34:2379
cluster is healthy
[root@k8s-master ~]# etcdctl -C http://etcd:4001 cluster-health
member 8e9e05c52164694d is healthy: got healthy result from http://10.173.32.34:2379
cluster is healthy
4.修改 docker 配置文件
[root@k8s-master~]# vim /etc/sysconfig/docker
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
fi
OPTIONS='--insecure-registry registry:5000'
在kubernetes master 上运行需要以下组件:
kubernetes api server
kubernetes controller manager
kubernetes scheduler
修改 apiserver
[root@k8s-master~]# vim /etc/kubernetes/apiserver
### # kubernetes system config # # The following values are used to configure the kube-apiserver #
# The address on the local server to listen to. KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
# The port on the local server to listen on. KUBE_API_PORT="--port=8080"
# Port minions listen on # KUBELET_PORT="--kubelet-port=10250"
# Comma separated list of nodes in the etcd cluster KUBE_ETCD_SERVERS="--etcd-servers=http://etcd:2379"
# Address range to use for services KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# default admission control policies KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"
➜ www ansible all -m command -a 'sed -i s@127.0.0.1:2379@etcd:2379@g /etc/sysconfig/flanneld' [WARNING]: Consider using template or lineinfile module rather than running sed
[root@k8s-master~]# kubectl --version Kubernetes v1.5.2 [root@k8s-master~]# kubectl get nodes NAME STATUS AGE k8s-nodea Ready 16m k8s-nodeb Ready 16m [root@k8s-master~]#