Kubernetes : Configure Admin Node
2015/12/13
|
Install Kubernetes which is the Orchestration System for Docker Containers.
For example, Configure Kubernetes Cluster with 1 Admon Node and 2 Container Node like follows.
+---------------------+
| [ Admin Node ] |
| dlp.server.world |
| |
+----------+----------+
|
+----------------------+ | +----------------------+
| [ Node01 ] |10.0.0.51 | 10.0.0.52| [ Node02 ] |
| node01.server.world +----------+----------+ node02.server.world |
| | | |
+----------------------+ +----------------------+
|
Configure Admon Node on this section.
| |
| [1] | Install required packages. |
| [root@dlp ~]#
yum -y install kubernetes etcd flannel
|
| [2] | Configure Kubernetes. |
# generate RSA key
[root@dlp ~]#
openssl genrsa -out /etc/kubernetes/service.key 2048
[root@dlp ~]#
vi /etc/kubernetes/controller-manager
# line 7: add
KUBE_CONTROLLER_MANAGER_ARGS="
--service_account_private_key_file=/etc/kubernetes/service.key
"
[root@dlp ~]#
vi /etc/kubernetes/apiserver
# line 8: change
KUBE_API_ADDRESS="--address=
0.0.0.0
"
# line 17: change to Admin Node's hostname or IP address
KUBE_ETCD_SERVERS="--etcd_servers=http://
dlp.server.world
:2379"
# line 20: IP range for Kubernetes service (change it if need)
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# line 26: add
KUBE_API_ARGS="
--service_account_key_file=/etc/kubernetes/service.key
"
[root@dlp ~]#
vi /etc/etcd/etcd.conf
# line 7: uncomment
ETCD_LISTEN_PEER_URLS="http://localhost:2380"
# line 8: add etcd Host's hostname or IP address
ETCD_LISTEN_CLIENT_URLS="
http://dlp.server.world:2379
,http://localhost:2379"
[root@dlp ~]#
vi /etc/kubernetes/config
# line 22: change to Admin Node's hostname or IP address
KUBE_MASTER="--master=http://
dlp.server.world
:8080"
systemctl start etcd kube-apiserver kube-controller-manager kube-scheduler
[root@dlp ~]#
systemctl enable etcd kube-apiserver kube-controller-manager kube-scheduler
|
| [3] | Configure Flannel networking. |
[root@dlp ~]#
vi flannel-config.json
# create new
# specify network range you like which is used inside Container Nodes
{
"Network":"172.16.0.0/16",
"SubnetLen":24,
"Backend":{
"Type":"vxlan",
"VNI":1
}
}
[root@dlp ~]#
vi /etc/sysconfig/flanneld
# line 4: change to Flannel Host's hostname or IP address
FLANNEL_ETCD="http://
dlp.server.world
:2379"
# line 8: confirm the parameter
FLANNEL_ETCD_KEY="/atomic.io/network"
etcdctl set atomic.io/network/config < flannel-config.json
[root@dlp ~]#
systemctl start flanneld
[root@dlp ~]#
systemctl enable flanneld
|
| [4] | Make sure th settings. It's OK if following result is displayed. |
| [root@dlp ~]#
kubectl cluster-info
Kubernetes master is running at http://localhost:8080 |
Nenhum comentário:
Postar um comentário