Skip to content

Instantly share code, notes, and snippets.

@jgaskins
Created November 1, 2022 21:55
Show Gist options
  • Save jgaskins/a5afc186cadb4085616104a5fc2b3892 to your computer and use it in GitHub Desktop.
Save jgaskins/a5afc186cadb4085616104a5fc2b3892 to your computer and use it in GitHub Desktop.
Give DigitalOcean load balancers provisioned for Kubernetes clusters a name and hostname so the Cert Manager HTTP solver will work
#!/usr/bin/env bash
# Fill out these two
export LB_HOSTNAME=example.com
export LB_NAME=my-lb
echo '{"metadata":{"annotations":{"service.beta.kubernetes.io/do-loadbalancer-hostname":"$LB_HOSTNAME","service.beta.kubernetes.io/do-loadbalancer-name":"$LB_NAME"}}}' |
envsubst |
awk "{ print \"'\" \$1 \"'\" }" |
xargs kubectl patch svc -n ingress-nginx ingress-nginx-controller -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment