Commit 5de90946 authored by Byungjoon Lee's avatar Byungjoon Lee

Fix the problem that Kubernetes UI is not installed by deployAddons.sh script in…

Fix the problem that Kubernetes UI is not installed by deployAddons.sh script in Ubuntu environment.
parent 5a9b36b7
...@@ -20,15 +20,70 @@ set -e ...@@ -20,15 +20,70 @@ set -e
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "config-default.sh" source "config-default.sh"
if [ "${ENABLE_CLUSTER_DNS}" == true ]; then KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh"
echo "Deploying DNS on kubernetes"
function init {
echo "Creating kube-system namespace..."
# use kubectl to create kube-system namespace
NAMESPACE=`eval "${KUBECTL} get namespaces | grep kube-system | cat"`
if [ ! "$NAMESPACE" ]; then
${KUBECTL} create -f namespace.yaml
echo "The namespace 'kube-system' is successfully created."
else
echo "The namespace 'kube-system' is already there. Skipping."
fi
echo
}
function deploy_dns {
echo "Deploying DNS on Kubernetes"
sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;" "${KUBE_ROOT}/cluster/addons/dns/skydns-rc.yaml.in" > skydns-rc.yaml sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;" "${KUBE_ROOT}/cluster/addons/dns/skydns-rc.yaml.in" > skydns-rc.yaml
sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/addons/dns/skydns-svc.yaml.in" > skydns-svc.yaml sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/addons/dns/skydns-svc.yaml.in" > skydns-svc.yaml
# use kubectl to create kube-system namespace KUBEDNS=`eval "${KUBECTL} get services --namespace=kube-system | grep kube-dns | cat"`
"${KUBE_ROOT}/cluster/kubectl.sh" create -f namespace.yaml
# use kubectl to create skydns rc and service if [ ! "$KUBEDNS" ]; then
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-rc.yaml # use kubectl to create skydns rc and service
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-svc.yaml ${KUBECTL} --namespace=kube-system create -f skydns-rc.yaml
${KUBECTL} --namespace=kube-system create -f skydns-svc.yaml
echo "Kube-dns rc and service is successfully deployed."
else
echo "Kube-dns rc and service is already deployed. Skipping."
fi
echo
}
function deploy_ui {
echo "Deploying Kubernetes UI..."
KUBEUI=`eval "${KUBECTL} get services --namespace=kube-system | grep kube-ui | cat"`
if [ ! "$KUBEUI" ]; then
# use kubectl to create kube-ui rc and service
${KUBECTL} --namespace=kube-system create \
-f ${KUBE_ROOT}/cluster/addons/kube-ui/kube-ui-rc.yaml
${KUBECTL} --namespace=kube-system create \
-f ${KUBE_ROOT}/cluster/addons/kube-ui/kube-ui-svc.yaml
echo "Kube-ui rc and service is successfully deployed."
else
echo "Kube-ui rc and service is already deployed. Skipping."
fi
echo
}
init
if [ "${ENABLE_CLUSTER_DNS}" == true ]; then
deploy_dns
fi
if [ "${ENABLE_CLUSTER_UI}" == true ]; then
deploy_ui
fi fi
...@@ -154,9 +154,9 @@ Also you can run Kubernetes [guest-example](../../examples/guestbook/) to build ...@@ -154,9 +154,9 @@ Also you can run Kubernetes [guest-example](../../examples/guestbook/) to build
#### Deploy addons #### Deploy addons
After the previous parts, you will have a working k8s cluster, this part will teach you how to deploy addons like dns onto the existing cluster. After the previous parts, you will have a working k8s cluster, this part will teach you how to deploy addons like DNS and UI onto the existing cluster.
The configuration of dns is configured in cluster/ubuntu/config-default.sh. The configuration of DNS is configured in cluster/ubuntu/config-default.sh.
```sh ```sh
ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}" ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
...@@ -172,7 +172,13 @@ The `DNS_SERVER_IP` is defining the ip of dns server which must be in the `SERVI ...@@ -172,7 +172,13 @@ The `DNS_SERVER_IP` is defining the ip of dns server which must be in the `SERVI
The `DNS_REPLICAS` describes how many dns pod running in the cluster. The `DNS_REPLICAS` describes how many dns pod running in the cluster.
After all the above variable have been set. Just type the below command Further, if you want to deploy UI addon, you should also modify the configuration file as follows:
```sh
ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
```
After all the above variable have been set, just type the below command.
```console ```console
$ cd cluster/ubuntu $ cd cluster/ubuntu
...@@ -180,7 +186,7 @@ $ cd cluster/ubuntu ...@@ -180,7 +186,7 @@ $ cd cluster/ubuntu
$ KUBERNETES_PROVIDER=ubuntu ./deployAddons.sh $ KUBERNETES_PROVIDER=ubuntu ./deployAddons.sh
``` ```
After some time, you can use `$ kubectl get pods` to see the dns pod is running in the cluster. Done! After some time, you can use `$ kubectl get pods --namespace=kube-system` to see the DNS and UI pods are running in the cluster. Done!
#### On going #### On going
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment