#!/bin/bash ## ## Script to deploy the kube-dns pod to the cluster ## echo "Using the core-dns.yaml file dapated from https://github.com/coredns/deployment/blob/master/kubernetes/coredns.yaml.sed" kubectl create -f core-dns.yaml --kubeconfig=certs-dir/admin.kubeconfig sleep 2 kubectl get pods -l k8s-app=core-dns -n kube-system -o wide --kubeconfig=certs-dir/admin.kubeconfig echo "Verifying this has worked" ## USing and older version of busybox than latest due to errors with nslookup on the latest versions: https://github.com/docker-library/busybox/issues/48 kubectl run busybox --image=busybox:1.28.4 --kubeconfig=certs-dir/admin.kubeconfig --command -- sleep 3600 sleep 10 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