Last active
March 10, 2020 10:22
-
-
Save darth-veitcher/60dfed5d9ad36ff8e8efe6892750df2b to your computer and use it in GitHub Desktop.
Setup NGINX ingress as a daemonset
This file contains hidden or 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
#! /bin/bash | |
# INSTALL INGRESS AS DAEMONSET | |
# Rationale for this is it allows us to use the nodeports | |
# on all of our nodes for ingress without needing to create | |
# a loadbalancer and have a separate IPV4 address. | |
# 1. Get the current IPV4 address | |
export EXTERNAL_ADDRESS=$(dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'\"' '{ print $2}') | |
# 2. Install latest Helm | |
curl -sf https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | |
# 2.1. Add the stable repo | |
helm repo add stable https://kubernetes-charts.storage.googleapis.com/ | |
helm repo updaste | |
# 2.2. Ensure helm understands environment | |
# see https://github.com/rancher/k3s/issues/1126 | |
kubectl config view --raw >~/.kube/config | |
# 3. Install ingress | |
helm install my-ingress stable/nginx-ingress \ | |
--set controller.kind=DaemonSet \ | |
--set controller.service.type=NodePort \ | |
--set controller.hostNetwork=true | |
# FINISH | |
echo "You can now access the ingress at ${EXTERNAL_ADDRESS}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to run quickly: