X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=blueprints%2FuCPE%2Fk8smaster_centos.sh;fp=blueprints%2FuCPE%2Fk8smaster_centos.sh;h=c78bc0d9fa03aca7e926e7456242dbf79e5ee434;hb=d63c1f66c2bbff6cd07ac5708f9939455b498b6a;hp=0000000000000000000000000000000000000000;hpb=a25e2c6b61cefe449f53a81e1a9f0b39a0a6208c;p=eliot.git diff --git a/blueprints/uCPE/k8smaster_centos.sh b/blueprints/uCPE/k8smaster_centos.sh new file mode 100755 index 0000000..c78bc0d --- /dev/null +++ b/blueprints/uCPE/k8smaster_centos.sh @@ -0,0 +1,39 @@ +#!/bin/bash -ex +############################################################################## +# Copyright (c) 2019 Huawei Tech and others. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Apache License, Version 2.0 # +# which accompanies this distribution, and is available at # +# http://www.apache.org/licenses/LICENSE-2.0 # +############################################################################## + +# constants + +POD_NETWORK_CIDR=192.168.0.0/16 +KUBE_VERSION=1.15.0-0 +KUBERNETES_CNI=0.7.5-0 + +# start + +hostname -I > hostname.tmp +MASTER_IP="$(cut -d ' ' -f 1 hostname.tmp)" +rm hostname.tmp + +# kubernetes installation + +sudo yum install -y kubelet-${KUBE_VERSION} kubectl-${KUBE_VERSION} \ +kubernetes-cni-${KUBERNETES_CNI} + +sudo systemctl daemon-reload +sudo systemctl restart kubelet + +# Initialize kubernetes on master + +sudo kubeadm init \ + --apiserver-advertise-address="${MASTER_IP}" \ + --pod-network-cidr="${POD_NETWORK_CIDR}" + +mkdir -p "${HOME}/.kube" +sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config" +sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config"