Sign inSign up

ungleich/ungleich-certbot

By ungleich

•Updated almost 2 years ago

Get certificates for IPv6 pods/services using certbot.

Image
0

1.6K

ungleich/ungleich-certbot repository overview

⁠ungleich-certbot

This container is made for getting real world certificates for your kubernetes cluster.

The assumption is that you can point the DNS name to the container from outside. This is by default given for IPv6 only kubernetes services.

The source of this image can be found on code.ungleich.ch⁠.

⁠Usage

  • Set the environment variable DOMAIN to specify the domain for which to get a certificate
  • Set the environment variable EMAIL (this is where letsencrypt sends warnings to)
  • Set the environment variable STAGING to "no" if you want to have proper certificates - this is to prevent you from asking the real letsencrypt service accidently by default
  • By default the container allows world read access to the certificates, so that non-root users can access the certificates. Set the LEAVE_PERMISSIONS_AS_IS environment variable to instruct the container not to change permissions
  • If you setup the variable START_NGINX to any value, the container will start nginx and reload after trying to renew the certificate
  • If you set the variable NGINX_HTTP_REDIRECT, the container will enable automatic redirect of http to https with the exception of the path /.well-known/acme-challenge/
docker run -e DOMAIN=example.com \
           -e [email protected] \
              ungleich/ungleich-certbot
⁠Nginx support

Using

docker run -e DOMAIN=example.com \
           -e [email protected] \
           -e START_NGINX=yes \
           -e STAGING=no \
              ungleich/ungleich-certbot

you will get a proper, real world usable nginx server. Inject the nginx configuration by meains of a volume to /etc/nginx/conf.d

⁠Nginx HTTP redirect support

Using

docker run -e DOMAIN=example.com \
           -e [email protected] \
           -e START_NGINX=yes \
           -e NGINX_HTTP_REDIRECT=yes \
           -e STAGING=no \
              ungleich/ungleich-certbot

the container will listen on port 80 and redirect the traffic to port 443 (https).

⁠Exiting after getting the certificate

By default, the container will stay alive and try to renew the certificate every 86400 seconds. If you set the environment variable ONLYGETCERT, then it will only get the certificates and exit.

⁠Only renewing the certificate

If you only want to trigger renewing existing certificates and skip getting the certificates initially, you can set the variable RENEWCERTSONCE, then it will only renew all certificates and exit.

  • If ONLYRENEWCERTS is set, only the reguler renew loop will run.
  • If ONLYRENEWCERTSONCE is set, renew will be run once and then the container exits

This mode can f.i. be used as a kubernetes Job⁠.

⁠Volumes

If you want to keep / use your certificates, you are advised to create a volume below /etc/letsencrypt.

⁠Changelog

⁠0.1.0

Usable with automatic renewal

⁠0.2.0

Added support for nginx webserver, based on official nginx image

⁠1.0.0
  • Start nginx in foreground, if not opted out
    • Nicely shows erros of nginx starting, which is what we need
  • Starting nginx by default on port 80
  • Removed variable NGINX to start nginx
  • Introducted variable NO_NGINX to prevent nginx from starting
  • Changed the wait time for domain resolution test to every 2 seconds
    • helps to startup faster
  • Added directory /nginx from which configuration files are sourced
    • can be used to overwrite built-in configurations
  • Create file /tmp/last_renew for checking when

⁠Kubernetes

See https://code.ungleich.ch/ungleich-public/ungleich-k8s/⁠.

Tag summary

Content type

Image

Digest

sha256:97243e385…

Size

34.4 MB

Last updated

almost 2 years ago

docker pull ungleich/ungleich-certbot:1.1.6