mardi 23 juillet 2019

Kubernetes, secret and ingress

Hello,

Theses days I spent a lof of times to setup ingress and TLS, to keep the commands needed :
To create TLS secret used by the ingress :
kubectl create secret tls secret-tls-name --key private.key --cert bundle.pem

To create bundle :
cat cer_file chain_file root_file > bundle.pem
If certificate are CER convert them to PEM first
openssl x509 -inform der -in certificate.cer -out certificate.pem

Then in ingress configuration specify in spec, the host, the backend, the tls file for the host :
spec:
  rules:
  - host: myapp.myhost.net
    http:
      paths:
      - backend:
          serviceName: myservice
          servicePort: 8080
        path: /
  tls:
  - hosts:
    - myapp.myhost.net
    secretName: secret-tls-name
You can multiple host and tls cert by host.