Skip to content

Instantly share code, notes, and snippets.

@ricardoapaes
Created September 21, 2020 06:01
Show Gist options
  • Save ricardoapaes/50abf8b26093e0a260fb6c08ed117bd2 to your computer and use it in GitHub Desktop.
Save ricardoapaes/50abf8b26093e0a260fb6c08ed117bd2 to your computer and use it in GitHub Desktop.
Create Kubernetes Nginx Controller with Certbot
#!/bin/bash
# Based in tutorial >>
# https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes-pt
# Retired from site, check for new versions. https://kubernetes.github.io/ingress-nginx/deploy/
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.35.0/deploy/static/provider/cloud/deploy.yaml
# Retired from site, check for new versions. https://cert-manager.io/docs/installation/kubernetes/
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.1/cert-manager.yaml
# Create file based in prod_issuer.yml changing your email and execute this command.
kubeclt apply -f prod_isseer.yaml
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
namespace: cert-manager
spec:
acme:
# The ACME server URL
server: https://acme-v02.api.letsencrypt.org/directory
# Email address used for ACME registration
email: youmail@youdomain.com.br
# Name of a secret used to store the ACME account private key
privateKeySecretRef:
name: letsencrypt-prod
# Enable the HTTP-01 challenge provider
solvers:
- http01:
ingress:
class: nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment