Create an Ingress Controller

In order to route traffic to applications deployed in Kubernetes it is good practice to use an Ingress Controller which proxies incoming request to the correct services and can handle things like TLS offloading. For more information on Ingress resources and Ingress Controllers see the official Kubernetes documentation.

NGINX Ingress Controller

A popular ingress controller is the nginx ingress controller.

NGINX Ingress Controller Installation

The easiest way to install it in your cluster is by installing the fully managed NGINX Ingress Controller Add-On.

Alternatively you can install it manually through Helm. When Helm is ready to be used, run:

helm install stable/nginx-ingress --name nginx-ingress --namespace kube-system  --set "rbac.create=true" --set "controller.replicaCount=2" --set "defaultBackend.replicaCount=2"

to install the NGINX Ingress Controller in the cluster. This will automatically create a Type Load Balancer service for you.

Cert-Manager

If you want to use Let's Encrypt to automatically manage TLS certificates for your ingress resources, you also have to install cert-manager.

Cert-Manager Installation

Addon

The easiest way to install the cert-manager is to use the managed Addon. After installation you only need to configure the issuers you want to use.

Manual installation

This can be done through Helm as well:

kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.7/deploy/manifests/00-crds.yaml

kubectl create namespace cert-manager

kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true

helm repo add jetstack https://charts.jetstack.io

helm repo update

helm install --name cert-manager --namespace cert-manager --version v0.7.0 jetstack/cert-manager

If you want to use the SysEleven DNS service for certificate DNS validation (e.g. required for wildcard certificates) you need to install the designate webhook in the cluster. Please follow instructions from the provided README.

Configure cluster issuer

After installing the cert-manager you have to configure how it shall fetch certificates. For that you have to add a ClusterIssuer to your Kubernetes cluster:

cat <<'EOF' | kubectl apply -f -
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    # The ACME server URL
    server: https://acme-v02.api.letsencrypt.org/directory
    # Email address used for ACME registration
    email: your-email@example.com
    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: letsencrypt-prod
    # Enable HTTP01 validations
    http01: {}
EOF

If you want to use DNS validation, please use the ClusterIssuer accordingly:

cat <<'EOF' | kubectl apply -f -
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    # The ACME server URL
    server: https://acme-v02.api.letsencrypt.org/directory
    # Email address used for ACME registration
    email: your-email@example.com
    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: letsencrypt-prod
    # Use designate webhook for DNS01 validations
    solvers:
    - dns01:
        webhook:
          groupName: acme.syseleven.de
          solverName: designatedns
EOF

In Deploy Application you can see how you can use this issuer to fetch a certificate.

Further information