CentOS7安装kubernetes cluster
时间:2015-08-17 12:58 来源:linux.it.net.cn 作者:IT
-
每台机器禁用iptables 避免和docker 的iptables冲突:
$ systemctl stop firewalld
$ systemctl disable firewalld
$ yum -y install ntp
$ systemctl start ntpd
$ systemctl enable ntpd
yum install docker -y
yum update -y
reboot
/usr/bin/docker -d --selinux-enabled --storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=/dev/mapper/VolGroup00-docker--pool
-
通过yum安装etcd和kubernetes
yum -y install etcd kubernetes
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
KUBE_API_ADDRESS="--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="--portal_net=10.254.0.0/16"
KUBE_ADMISSION_CONTROL="--admission_control=NamespaceAutoProvision,LimitRanger,ResourceQuota"
KUBE_API_ARGS=""
KUBELET_ADDRESSES="--machines=192.168.5.132,192.168.5.133"
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
etcdctl mk /coreos.com/network/config '{"Network":"172.17.0.0/16"}'
-
安装flannel和kubernetes
yum -y install flannel kubernetes
FLANNEL_ETCD="http://192.168.5.131:2379"
KUBE_MASTER="--master=http://192.168.5.131:8080"
###
# kubernetes kubelet (minion) config
# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=192.168.5.132"
# 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.132"
# location of the api-server
KUBELET_API_SERVER="--api_servers=http://192.168.5.131:8080"
# Add your own!
KUBELET_ARGS=""
###
# kubernetes kubelet (minion) config
# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=192.168.5.133"
# 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.133"
# location of the api-server
KUBELET_API_SERVER="--api_servers=http://192.168.5.131:8080"
# Add your own!
KUBELET_ARGS=""
for SERVICES in kube-proxy kubelet docker flanneld; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
ip a | grep flannel | grep inet
inet 172.17.20.0/16 scope global flannel0
$ ip a | grep flannel | grep inet
inet 172.17.21.0/16 scope global flannel0
[root@k8s_master ~]# kubectl get nodes
NAME LABELS STATUS
192.168.5.132 kubernetes.io/hostname=192.168.5.132 Ready
192.168.5.133 kubernetes.io/hostname=192.168.5.133 Ready
is forbidden: no API token found for service account default/default, retry after the token is automatically created and added to the service account
# default admission control policies#
KUBE_ADMISSION_CONTROL="--admission_control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
SecurityContextDeny,ServiceAccount
(责任编辑:IT)
(责任编辑:IT) |