#!/bin/bash ## ## Script to deploy the kube-dns pod to the cluster ## echo "Taking the kube-dns.yaml file from the Kubernetes the Hard Way author" wget https://storage.googleapis.com/kubernetes-the-hard-way/kube-dns.yaml kubectl create -f kube-dns.yaml --kubeconfig=certs-dir/admin.kubeconfig sleep 2 kubectl get pods -l k8s-app=kube-dns -n kube-system -o wide --kubeconfig=certs-dir/admin.kubeconfig echo "Verifying this has worked" kubectl run busybox --image=busybox --kubeconfig=certs-dir/admin.kubeconfig --command -- sleep 3600 echo "Is the busybox pod running?" kubectl get pods -l run=busybox --kubeconfig=certs-dir/admin.kubeconfig echo "Get the pod name" POD_NAME=$(kubectl get pods -l run=busybox --kubeconfig=certs-dir/admin.kubeconfig -o jsonpath="{.items[0].metadata.name}") echo "Is the DNS pod functional?" kubectl exec -ti --kubeconfig=certs-dir/admin.kubeconfig $POD_NAME -- nslookup kubernetes