Skip to content

Instantly share code, notes, and snippets.

@darth-veitcher
Last active March 10, 2020 10:22
Show Gist options
  • Save darth-veitcher/60dfed5d9ad36ff8e8efe6892750df2b to your computer and use it in GitHub Desktop.
Save darth-veitcher/60dfed5d9ad36ff8e8efe6892750df2b to your computer and use it in GitHub Desktop.
Setup NGINX ingress as a daemonset
#! /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}"
@darth-veitcher
Copy link
Author

to run quickly:

curl $(curl https://bit.ly/330OZEQ | grep -Eo “https://(.*sh)”) | bash -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment