mirror of https://github.com/k3s-io/k3s
Merge pull request #12456 from bjlee72/ubuntu-ui-patch
Fix the problem of the deployAddons.shpull/6/head
commit
22b8197a4a
|
@ -20,15 +20,70 @@ set -e
|
|||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "config-default.sh"
|
||||
if [ "${ENABLE_CLUSTER_DNS}" == true ]; then
|
||||
echo "Deploying DNS on kubernetes"
|
||||
KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||
|
||||
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_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/addons/dns/skydns-svc.yaml.in" > skydns-svc.yaml
|
||||
|
||||
# use kubectl to create kube-system namespace
|
||||
"${KUBE_ROOT}/cluster/kubectl.sh" create -f namespace.yaml
|
||||
KUBEDNS=`eval "${KUBECTL} get services --namespace=kube-system | grep kube-dns | cat"`
|
||||
|
||||
if [ ! "$KUBEDNS" ]; then
|
||||
# use kubectl to create skydns rc and service
|
||||
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-rc.yaml
|
||||
"${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
|
||||
|
||||
|
|
|
@ -154,9 +154,9 @@ Also you can run Kubernetes [guest-example](../../examples/guestbook/) to build
|
|||
|
||||
#### 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
|
||||
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
|
|||
|
||||
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
|
||||
$ cd cluster/ubuntu
|
||||
|
@ -180,7 +186,7 @@ $ cd cluster/ubuntu
|
|||
$ 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue