Sign inSign up

jetstack/kube-lego

By jetstack

Updated about 8 years ago

Kube-Lego automatically requests certificates for Kubernetes Ingress resources from Let's Encrypt

Artifact
Image
9

50M+

jetstack/kube-lego repository overview

kube-lego

kube-lego automatically requests certificates for Kubernetes Ingress resources from Let's Encrypt

Build Status

Screencast

Kube Lego screencast

Features

  • Recognizes the need of new certificates for this cases
    • domain name missing
    • certificate expired
    • certificate unparseable
  • Obtains certificates per TLS object in ingress resources and stores it in Kubernetes secrets using HTTP-01 challenge
  • Creates a user account (incl. private key) for Let's Encrypt and stores it in Kubernetes secrets (secret name is configurable via LEGO_SECRET_NAME)
  • Watches changes of ingress resources and reevaluate certificates
  • Configures endpoints for HTTP-01 challenge in a separate ingress resource (ingress name is configurable in LEGO_INGRESS_NAME)

Requirements

  • Kubernetes 1.2+
  • Compatible ingress controller (cf. here)
  • Non-production use case :laughing:

Usage

run kube-lego
  • deployment for kube-lego
    • don't forget to configure LEGO_EMAIL with your mail address
    • the default value of LEGO_URL is the Let's Encrypt staging environment. If you want to get "real" certificates you have to configure their production env.
  • service pointing to kube-lego pods
how kube-lego works

As soon as the kube-lego daemon is running, it will look for ingress resources that have this annotations:

metadata:
  annotations:
    kubernetes.io/tls-acme: "true"

Every ingress resource that has this annotations will be monitored by kube-lego (cluster-wide in all namespaces). The only part that is watched is the list spec.tls. Every element will get their own certificate through Let's encrypt.

Let's take a look at this ingress controller:

spec:
  tls:
  - secretName: mysql-tls
    hosts:
    - phpmyadmin.example.com
    - mysql.example.com
  - secretName: postgres-tls
    hosts:
    - postgres.example.com

kube-lego will obtain two certificates (one with phpmyadmin.example.com and mysql.example.com, the other with postgers.example.com). Please note:

  • The secretName statements have to be unique per namespace
  • secretName is required (even if no secret exists with that name, as it will be created by kube-lego)

##Ingress controllers

Nginx Ingress Controller
  • available through image gcr.io/google_containers/nginx-ingress-controller
  • fully supports kube-lego from version 0.8

Environment variables

NameRequiredDefaultDescription
LEGO_EMAILy-E-Mail address for the ACME account, used to recover from lost secrets
LEGO_NAMESPACEndefaultNamespace where kube-lego is running in
LEGO_URLnhttps://acme-staging.api.letsencrypt.org/directoryURL for the ACME server
LEGO_SECRET_NAMEnkube-lego-accountName of the secret in the same namespace that contains ACME account secret
LEGO_SERVICE_NAMEnkube-legoService name that connects to this pod
LEGO_INGRESS_NAMEnkube-legoIngress name which contains the routing for HTTP verification
LEGO_PORTn8080Port where this daemon is listening for verifcation calls (HTTP method)
LEGO_CHECK_INTERVALn8hInterval for periodically certificate checks (to find expired certs)

Full example

See the examples directory.

Authors

Christian Simon for Jetstack Ltd

Tag summary

Content type

Image

Digest

Size

12.2 MB

Last updated

about 8 years ago

docker pull jetstack/kube-lego