# 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://192.168.5.221:8080"
###
# 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="--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://127.0.0.1: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,ResourceQuota"
# Add your own!
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
# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.5.221:8080"
#配置kubelet服务。/etc/kubernetes/kubelet
1
2
3
4
5
6
7
8
# 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=192.168.5.237"
# location of the api-server
KUBELET_API_SERVER="--api-servers=http://192.168.5.221:8080"
#启动服务
1
2
3
4
5
for SERVICES in kube-proxy kubelet docker flanneld; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
如果报错Bridge ip (...) does not match existing bridge configuration,是因为docker的bridge 先于flannel启动导致冲突
删除docker 0
ip a | grep -E "flannel|docker"|grep inet
inet 172.17.58.0/16 scope global flannel0
inet 172.17.58.1/24 scope global docker0
#现在登陆master,确认minions的状态
1
2
3
4
[iyunv@k8s_master etcd]# kubectl get nodes
NAME LABELS STATUS AGE
192.168.5.222 kubernetes.io/hostname=192.168.5.222 Ready 1d
192.168.5.237 kubernetes.io/hostname=192.168.5.237 Ready 2d