How to get ssl on a kubernetes application?

fay picture fay · Feb 8, 2017 · Viewed 20.5k times · Source

I have a simple meteor app deployed on kubernetes. I associated an external IP address with the server, so that it's accessible from within the cluster. Now, I am up to exposing it to the internet and securing it (using HTTPS protocol). Can anyone give simple instructions for this section?

Answer

Janos Lenart picture Janos Lenart · Feb 8, 2017

In my opinion kube-lego is the best solution for GKE. See why:

Example configuration (that's it!):

kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-lego
  namespace: kube-lego
data:
  lego.email: "your@email"
  lego.url: "https://acme-v01.api.letsencrypt.org/directory"

Example Ingress (you can create more of these):

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: site1
  annotations:
    # remove next line if not using nginx-ingress-controller
    kubernetes.io/ingress.class: "nginx"
    # next line enable kube-lego for this Ingress
    kubernetes.io/tls-acme: "true"
spec:
  tls:
  - hosts:
    - site1.com
    - www.site1.com
    - site2.com
    - www.site2.com
    secretName: site12-tls
  rules:
    ...