Kubernetes環境搭建on centos7.1
阿新 • • 發佈:2018-12-26
CentOS裸機安裝
依賴環境:
CentOS7.1
Docker 1.8.2
Kubernetes: 1.2.0
Golang: 1.4.2
etcd
兩臺機器:
centos-master 10.10.3.184
centos-minion 10.10.3.185
全是用yum方式安裝
安裝Docker、etcd、kubernates
yum update
配置virt7-docker-common-testing源
[virt7-docker-common-testing]
gpgcheck=0
# kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
# kube-apiserver.service
# kube-controller-manager.service
# kube-scheduler.service
# kubelet.service
# kube-proxy.service
# 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://centos-master:8080"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://localhost:2379"
yum -y install --enablerepo=virt7-docker-common-testing kubernetes
yum -y install etcd galang docker
centos-master執行kubernetes三個元件:apiserver、scheduler、controller-manager,相關配置項也只涉及這三塊。
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
centos-minion執行kubernetes的兩個元件:proxy、kubelet。
需要配置/etc/kubernetes/config
#### kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
# kube-apiserver.service
# kube-controller-manager.service
# kube-scheduler.service
# kubelet.service
# kube-proxy.service
# 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://centos-master:8080"
# Comma separated list of nodes in the etcd cluster
for SERVICES in kube-proxy kubelet docker; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done