Last active
December 12, 2019 17:39
-
-
Save kam1kaze/ae1b745c30ffff41ac78c52e22d46ba0 to your computer and use it in GitHub Desktop.
install nodelocaldns on managed kubernetes clusters like GKE, EKS, AKS etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Example: | |
# | |
# ❯ ./nodelocaldns.sh | kubectl apply -f - | |
# serviceaccount/node-local-dns created | |
# service/kube-dns-upstream created | |
# configmap/node-local-dns created | |
# daemonset.apps/node-local-dns created | |
# | |
# https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/README.md | |
KUBE_DNS_SERVER_IP=$(kubectl get service -n kube-system kube-dns -o json | jq -r .spec.clusterIP) | |
KUBE_DNS_DOMAIN="cluster.local" | |
KUBE_LOCAL_DNS="169.254.20.10" | |
# https://github.com/kubernetes/kubernetes/pull/84383/files | |
curl -s https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml \ | |
| sed -e "s,__PILLAR__DNS__DOMAIN__,${KUBE_DNS_DOMAIN},g" \ | |
| sed -e "s,__PILLAR__LOCAL__DNS__,${KUBE_LOCAL_DNS},g" \ | |
| sed -e "s,__PILLAR__DNS__SERVER__,${KUBE_DNS_SERVER_IP},g" \ | |
| sed -e '\,^\s*kubernetes.io/cluster-service:,d' \ | |
| sed -e '\,^\s*addonmanager.kubernetes.io/mode:,d' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment