Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
1 view
in DevOps and Agile by (29.3k points)

I have an application on GKE that I wish to be available via HTTPS only, so I have gotten a signed certificate to secure the application using TLS.

I have checked out a lot of tutorials on how I can do this, but they all refer to using Ingress and automatically requesting the certificate using, let’s encrypt and KubeLego. But I wish to continue using the external load balancers (the compute engine instances that have provided me) but I just want my application to be accessible via https.

How do I apply my server.crt and server.key files to enable https? Do I apply it to the Load balancers or to the kubernetes cluster?

1 Answer

0 votes
by (50.2k points)
edited by

When it comes to exposing apps over https then ingress is the best way to do it and it specifies the resource to a backend service due to this your application is exposed as a kubernetes service.

Now, specifically in Google Kubernetes Engine, any ingress resources defined in your cluster will be served by a Google Cloud Load Balancer, so you need not define any new ingress.

As you mentioned about tla you can use your own certificate also and that should be uploaded in the cluster through a kubernetes secret. Uploading through secret can be done with the following command.

kubectl create secret tls my-app-certs --key /tmp/tls.key --cert /tmp/tls.crt

You can define the address to key and certificate (here tls.key and tls.sert are the key and certificate respectively). Now you defined the certificate in secret you can  mention it in your ingress

apiVersion: extensions/v1beta1

kind: Ingress

metadata:

  name: my-app-ingress

spec:

  tls:

  - secretName: my-app-certs

  backend:

    serviceName: s1

    servicePort: 80

After setting this ingress the google kubernetes engine will allocate a public IP address for getting that ip run 

Kubectl get ingress my-app-ingress

It will give the public ip, please refer 

https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer

For more information please go through the following tutorial to get more info about kubernetes:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 30, 2020 in DevOps and Agile by dev_sk2311 (42.8k points)

Browse Categories

...