Add deployments for stackube addons
Deploy stackube addons, including * stackube-controller * stackube-proxy * kubestack cni plugin * kube-dns Change-Id: I44bcaad3b30931ba79c80f37b0e33033ef94bca5
This commit is contained in:
parent
e978fceacb
commit
8dd1fa2992
@ -11,3 +11,5 @@ apiServerExtraArgs:
|
|||||||
runtime-config: "api/all=true"
|
runtime-config: "api/all=true"
|
||||||
feature-gates: "AllAlpha=true"
|
feature-gates: "AllAlpha=true"
|
||||||
experimental-keystone-url: "https://KEYSTONE_HOST:5000/v2.0"
|
experimental-keystone-url: "https://KEYSTONE_HOST:5000/v2.0"
|
||||||
|
networking:
|
||||||
|
podSubnet: "CLUSTER_CIDR"
|
||||||
|
@ -15,33 +15,6 @@
|
|||||||
|
|
||||||
STACKUBE_ROOT=$(dirname "${BASH_SOURCE}")
|
STACKUBE_ROOT=$(dirname "${BASH_SOURCE}")
|
||||||
|
|
||||||
function configure_cni {
|
|
||||||
sudo mkdir -p /etc/cni/net.d
|
|
||||||
sudo sh -c "cat >/etc/cni/net.d/10-mynet.conf <<EOF
|
|
||||||
{
|
|
||||||
\"cniVersion\": \"0.3.0\",
|
|
||||||
\"name\": \"mynet\",
|
|
||||||
\"type\": \"bridge\",
|
|
||||||
\"bridge\": \"cni0\",
|
|
||||||
\"isGateway\": true,
|
|
||||||
\"ipMasq\": true,
|
|
||||||
\"ipam\": {
|
|
||||||
\"type\": \"host-local\",
|
|
||||||
\"subnet\": \"${CONTAINER_CIDR}\",
|
|
||||||
\"routes\": [
|
|
||||||
{ \"dst\": \"0.0.0.0/0\" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF"
|
|
||||||
sudo sh -c 'cat >/etc/cni/net.d/99-loopback.conf <<EOF
|
|
||||||
{
|
|
||||||
"cniVersion": "0.3.0",
|
|
||||||
"type": "loopback"
|
|
||||||
}
|
|
||||||
EOF'
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_docker {
|
function install_docker {
|
||||||
if is_ubuntu; then
|
if is_ubuntu; then
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
@ -124,7 +97,7 @@ gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
|
|||||||
EOF'
|
EOF'
|
||||||
sudo setenforce 0
|
sudo setenforce 0
|
||||||
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
|
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
|
||||||
sudo yum install -y kubernetes-cni kubelet-1.7.0-0 kubeadm-1.7.0-0 kubectl-1.7.0-0
|
sudo yum install -y kubelet-1.7.3-1 kubeadm-1.7.3-1 kubectl-1.7.3-1
|
||||||
elif is_ubuntu; then
|
elif is_ubuntu; then
|
||||||
sudo apt-get update && sudo apt-get install -y apt-transport-https
|
sudo apt-get update && sudo apt-get install -y apt-transport-https
|
||||||
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||||
@ -132,15 +105,16 @@ EOF'
|
|||||||
deb http://apt.kubernetes.io/ kubernetes-xenial main
|
deb http://apt.kubernetes.io/ kubernetes-xenial main
|
||||||
EOF'
|
EOF'
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y kubernetes-cni kubelet=1.7.0-00 kubeadm=1.7.0-00 kubectl=1.7.0-00
|
sudo apt-get install -y kubelet=1.7.3-01 kubeadm=1.7.3-01 kubectl=1.7.3-01
|
||||||
else
|
else
|
||||||
exit_distro_not_supported
|
exit_distro_not_supported
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_master {
|
function install_master {
|
||||||
sed -i "s/KEYSTONE_HOST/${SERVICE_HOST}/g" ${STACKUBE_ROOT}/kubeadm.yaml
|
sed -i "s#KEYSTONE_HOST#${SERVICE_HOST}#g" ${STACKUBE_ROOT}/kubeadm.yaml
|
||||||
sudo kubeadm init --pod-network-cidr ${CLUSTER_CIDR} --config ${STACKUBE_ROOT}/kubeadm.yaml
|
sed -i "s#CLUSTER_CIDR#${CLUSTER_CIDR}#g" ${STACKUBE_ROOT}/kubeadm.yaml
|
||||||
|
sudo kubeadm init --config ${STACKUBE_ROOT}/kubeadm.yaml
|
||||||
# Enable schedule pods on the master for testing.
|
# Enable schedule pods on the master for testing.
|
||||||
sudo cp /etc/kubernetes/admin.conf $HOME/
|
sudo cp /etc/kubernetes/admin.conf $HOME/
|
||||||
sudo chown $(id -u):$(id -g) $HOME/admin.conf
|
sudo chown $(id -u):$(id -g) $HOME/admin.conf
|
||||||
@ -148,6 +122,39 @@ function install_master {
|
|||||||
kubectl taint nodes --all node-role.kubernetes.io/master-
|
kubectl taint nodes --all node-role.kubernetes.io/master-
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_stackube_addons {
|
||||||
|
# remove kube-dns deployment
|
||||||
|
kubectl -n kube-system delete deployment kube-dns
|
||||||
|
# remove kube-proxy daemonset
|
||||||
|
kubectl -n kube-system delete daemonset kube-proxy
|
||||||
|
|
||||||
|
source openrc admin admin
|
||||||
|
public_network=$(openstack network list --long -f value | grep External | awk '{print $1}')
|
||||||
|
cat >stackube-configmap.yaml <<EOF
|
||||||
|
kind: ConfigMap
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: stackube-config
|
||||||
|
namespace: kube-system
|
||||||
|
data:
|
||||||
|
auth-url: "https://${SERVICE_HOST}/identity_admin/v2.0"
|
||||||
|
username: "admin"
|
||||||
|
password: "${ADMIN_PASSWORD}"
|
||||||
|
tenant-name: "admin"
|
||||||
|
region: "RegionOne"
|
||||||
|
ext-net-id: "${public_network}"
|
||||||
|
plugin-name: "ovs"
|
||||||
|
integration-bridge: "br-int"
|
||||||
|
user-cidr: "${CLUSTER_CIDR}"
|
||||||
|
user-gateway: "${CLUSTER_GATEWAY}"
|
||||||
|
kubernetes-host: "${SERVICE_HOST}"
|
||||||
|
kubernetes-port: "6443"
|
||||||
|
EOF
|
||||||
|
kubectl create -f stackube-configmap.yaml
|
||||||
|
kubectl create -f ${STACKUBE_ROOT}/../deployment/stackube.yaml
|
||||||
|
kubectl create -f ${STACKUBE_ROOT}/../deployment/stackube-proxy.yaml
|
||||||
|
}
|
||||||
|
|
||||||
function install_node {
|
function install_node {
|
||||||
if [ "${KUBEADM_TOKEN}" = "" ]; then
|
if [ "${KUBEADM_TOKEN}" = "" ]; then
|
||||||
echo "KUBEADM_TOKEN must be set for node"
|
echo "KUBEADM_TOKEN must be set for node"
|
||||||
@ -171,12 +178,12 @@ function remove_kubernetes {
|
|||||||
if [ "${CONTAINER_RUNTIME}" = "frakti" ]; then
|
if [ "${CONTAINER_RUNTIME}" = "frakti" ]; then
|
||||||
sudo yum remove -y qemu-hyper hyperstart hyper-container libvirt
|
sudo yum remove -y qemu-hyper hyperstart hyper-container libvirt
|
||||||
fi
|
fi
|
||||||
sudo yum remove -y kubernetes-cni kubelet kubeadm kubectl docker
|
sudo yum remove -y kubelet kubeadm kubectl docker
|
||||||
elif is_ubuntu; then
|
elif is_ubuntu; then
|
||||||
if [ "${CONTAINER_RUNTIME}" = "frakti" ]; then
|
if [ "${CONTAINER_RUNTIME}" = "frakti" ]; then
|
||||||
sudo apt-get remove -y hyperstart hyper-container qemu libvirt-bin
|
sudo apt-get remove -y hyperstart hyper-container qemu libvirt-bin
|
||||||
fi
|
fi
|
||||||
sudo apt-get remove -y kubernetes-cni kubelet kubeadm kubectl docker
|
sudo apt-get remove -y kubelet kubeadm kubectl docker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo rm -rf /usr/bin/frakti /etc/cni/net.d /lib/systemd/system/frakti.service
|
sudo rm -rf /usr/bin/frakti /etc/cni/net.d /lib/systemd/system/frakti.service
|
||||||
@ -207,13 +214,13 @@ function init_stackube {
|
|||||||
|
|
||||||
if is_service_enabled kubernetes_master; then
|
if is_service_enabled kubernetes_master; then
|
||||||
install_master
|
install_master
|
||||||
|
install_stackube_addons
|
||||||
elif is_service_enabled kubernetes_node; then
|
elif is_service_enabled kubernetes_node; then
|
||||||
install_node
|
install_node
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_stackube {
|
function configure_stackube {
|
||||||
configure_cni
|
|
||||||
configure_kubelet
|
configure_kubelet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ KUBERNETES_MASTER_PORT=${KUBERNETES_MASTER_PORT:-6443}
|
|||||||
# Kubeadm token, only for minions
|
# Kubeadm token, only for minions
|
||||||
KUBEADM_TOKEN=${KUBEADM_TOKEN:-""}
|
KUBEADM_TOKEN=${KUBEADM_TOKEN:-""}
|
||||||
# The version of frakti
|
# The version of frakti
|
||||||
FRAKTI_VERSION=${FRAKTI_VERSION:-"v0.2"}
|
FRAKTI_VERSION=${FRAKTI_VERSION:-"v1.0"}
|
||||||
# Kubernetes CLUSTER CIDR
|
# Kubernetes CLUSTER CIDR
|
||||||
CLUSTER_CIDR=${CLUSTER_CIDR:-"10.244.0.0/16"}
|
CLUSTER_CIDR=${CLUSTER_CIDR:-"10.244.0.0/16"}
|
||||||
|
CLUSTER_GATEWAY=${CLUSTER_GATEWAY:-"10.244.0.1"}
|
||||||
# CNI Configurations
|
# CNI Configurations
|
||||||
# Brige network plugin is used now
|
# Brige network plugin is used now
|
||||||
# TODO: replace network plugin with stackube-cni
|
# TODO: replace network plugin with stackube-cni
|
||||||
CONTAINER_CIDR=${CONTAINER_CIDR:-"10.244.1.0/24"}
|
CONTAINER_CIDR=${CONTAINER_CIDR:-"10.244.1.0/24"}
|
||||||
CNI_VERSION=${CNI_VERSION:-"v0.5.2"}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user