Publishing an HTTPS Ingress to ELB (Example)

Obtaining and Encrypting the ELB Certificate

  1. Obtain the example ELB certificate and private key.

    Log in to the management console and click in the upper left corner. In the service list, choose Network > Elastic Load Balance. In the navigation pane, choose Elastic Load Balance > Certificates. On the page displayed, click Create Certificate.

    In the dialog box displayed, configure the certificate and private key. In this section, the example values are used. You can click next to View Example to automatically populate the values.
    Figure 1 Obtaining the certificate and private key

  2. Write the certificate and private key to two files and use cat xxx | base64 | tr -d '\n' to perform Base64 encryption to obtain the encrypted fields.

    Figure 2 Obtaining the encrypted fields

Generating the Secret File

The generated secret file is as follows:

apiVersion: v1
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0******dDOTlIV3A2S3czN1JMOFdvQjhHV0ZVMFE0dEhMT2pCSXhrWlJPUFJoSCt6TUlycVVleHY2ZnNiM05XS2hubGZoMU1qNXdRRTRMZG89Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
  tls.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRV*******SGp5YTRJa2trZ3Q0MHExTXJVc2dJWWJGWU1mMgotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
kind: Secret
metadata:
  annotations:
    description: test for ingressTLS secrets
  name: elb-https-secret
  namespace: default
type: IngressTLS

Create the secret.

kubectl create –f  xxx.yml

Create an ingress and use the secret.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/elb.ip: 192.168.0.244
    kubernetes.io/elb.port: "7777"
  name: https-ing
  namespace: default
spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: jenkinstest
          servicePort: 8080
        path: /test-https
        property:
          ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH
  tls:
  - secretName: elb-https-secret

Create an ingress.

kubectl create –f  xxx.yml