This post will show you how to create and use our own SSL / TLS Certificate for our applications on kubernetes ingress controller. So that our users will be able to access our application over https.
You must have running applications on kubernetes cluster with ingress controller.
If you are new to kubernetes and want to learn about kubernetes from basics, Refer the below links and also you can checkout all tutorial videos for free on YouTube and do subscribe for more free videos.
What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained
If you are new to kubernetes and want to learn about kubernetes from basics, Refer the below links and also you can checkout all tutorial videos for free on YouTube and do subscribe for more free videos.
What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained
Also You can Watch this Entire Tutorial video with more examples on our YouTube Channel - How to Create SSL/TLS Certificate for Ingress Controller.
Lets get started.
How to Create SSL/TLS Certificate for Ingress Controller
Create a Self Signed Certificate:
Lets say, I want to create a certificate for the domain knote.learnitguide.com.
Use openssl command to create a Self Signed SSL / TLS Certificate.
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out knote-ingress-tls.crt -keyout knote-ingress-tls.key -subj "/CN=knote.learnitguide.com/O=knote-ingress-tls"
Our self signed certificate is created under the local directory.
Create a Secret:
Use kubectl create secret command to create the secret.
kubectl create secret tls knote-ingress-tls --namespace default --key knote-ingress-tls.key --cert knote-ingress-tls.crt
You can use kubectl get secret command to list out the existing secrets.
kubectl get secret
Make sure the secret we have created is available.
Edit your ingress rule to specify the certificate:
Add a section for tls under spec. Define the list of host which al are going to use this particular certificate. Finally the specify the secretname with secretName option.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
tls:
- hosts:
- knote.learnitguide.com
secretName: knote-ingress-tls
rules:
- host: knote.learnitguide.com
http:
paths:
- backend:
serviceName: knote
servicePort: 80
This is how we have to use the certificate for our applications.
Save and exit the ingress file. Apply the changes.
kubectl apply -f ingressfile.yaml
Also You can Watch this Entire Tutorial video with more examples on our YouTube Channel. Make use of it.
Hope you have got an idea how to create and use our own SSL / TLS Certificate for our ingress controller.
Also refer below related articles and checkout all tutorial videos for free on youtube.
What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained
Keep practicing and have fun. Leave your comments if any.
Stay connected with us on social networking sites, Thank you.
0 Comments