#!/bin/bash echo "" echo "... ] DEPLOYING SYSTEM SERVICES [ ..." HOME=$( cd "$(dirname "$0")" && pwd ) source $HOME/config if [ -f $HOME/config-coreapps ]; then echo "config-coreapps file FOUND :)" source $HOME/config-coreapps else echo "config-coreapps file is missing." exit 1 fi export KUBECONFIG=$ADMIN_KUBECONFIG export HELM_CACHE_HOME=~/.cache/helm export HELM_CONFIG_HOME=~/.config/helm export HELM_DATA_HOME=~/.local/share/helm # Setup kube-apiserver RBAC for kubelet authorization kubectl apply -f yaml/system/kube-apiserver-to-kubelet-clusterrole.yaml kubectl apply -f yaml/system/kube-apiserver-to-kubelet-clusterrolebinding.yaml # Setup Calico SDN kubectl apply -f yaml/calico/rbac-calico-etcd.yaml printf "\ndeploying calico sdn...\n" ECA64=$( base64 -w0 ${CA_DIR}/etcd-ca.crt ) ECERT64=$( base64 -w0 ${CA_DIR}/etcd.crt ) EKEY64=$( base64 -w0 ${CA_DIR}/etcd.key ) cat yaml/calico/calico-etcd.yaml | \ sed -e "s@k8x_calico_etcd_endpoint@https://${ETCD_1_IP}:2379,https://${ETCD_2_IP}:2379,https://${ETCD_3_IP}:2379@g" | \ sed -e "s@#\ etcd-ca:\ null@etcd-ca:\ ${ECA64}@g" | \ sed -e "s@#\ etcd-cert:\ null@etcd-cert:\ ${ECERT64}@g" | \ sed -e "s@#\ etcd-key:\ null@etcd-key:\ ${EKEY64}@g" | \ sed -e "s@k8x_calico_pool@${CNI_NET}@g" | kubectl apply -f - # Setup Helm package manager printf "\nsetting up kubernetes helm repos...\n" helm repo add stable https://kubernetes-charts.storage.googleapis.com helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com helm repo update # Setup DNS printf "\ndeploying coredns...\n" kubectl apply -f yaml/coredns/coredns.yaml # Setup Metrics provider printf "\ndeploying metrics-server...\n" kubectl apply -f yaml/metrics-server/components.yaml