• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer

GitopsCentral

  • Home
  • Courses
  • Roadmap
  • About
  • Log In
  • Sign Up

How to setup TLS certs in nginx ingress using certbot

November 18, 2020 by shaik zillani

In this blog post, I will demonstrate you how to create free certs for your domain hosted on route53 using certbot and how to terminate TLS through the nginx Ingress controller.

If you are running your application on kubernetes behind a nginx ingress controller & want to terminate TLS validation at nginx ingress, you can freely create certificates that will be valid for 60 days using certbot. You can do this in three simple steps.

Please note that this example is for domain registered from amazon route53.

Pre-requisites

These are some pre-requisites you need to install,

  • python 3.x
  • certbot
  • certbot-dns-route53

You can install certbot using python pip installer,

The procedure is same for Mac, Windows or Linux

pip install certbot
pip install certbot-dns-route53

Now, let’s try to create new certificate,

Create certificate using certbot
certbot certonly -d foo.bar.com --dns-route53 --logs-dir letsencrypt/log/ --config-dir letsencrypt/config/ --work-dir letsencrypt/work/ -m shaikzillani@gmail.com --agree-tos --non-interactive --server https://acme-v02.api.letsencrypt.org/directory

Replace foo.bar.com with your domain and use your email in the above command

Install the certificate as secret on k8s
kubectl create secret tls foo.bar.com-tls --cert=./fullchain.pem --key=./privkey.pem -n test-namespace

This will create certs under letsencrypt directory, navigate to that directory where certs are created and execute this command above.

Update helm chart deployment with TLS secret
    tls:
      - secretName: foo.bar.com-tls
        hosts:
          - foo.bar.com

If you visit your website over https on your browser, the SSL connection should be established successfully.

kubernetes helm,  ingress,  kubernetes,  nginx

Primary Sidebar

en English
ar Arabiczh-CN Chinese (Simplified)nl Dutchen Englishfr Frenchde Germanhi Hindiid Indonesianit Italianja Japanesems Malaypt Portugueseru Russianes Spanishte Telugu

Course Tags

concurrency free go golang

Recent Posts

  • Roadmap to Mastery
  • Increase SSH connection timeout
  • Check Certificate expiry in Kubernetes
  • space invaders in golang
  • creating kubernetes cluster using eksctl
  • Facebook
  • GitHub
  • YouTube

Contact

Navigation

  • goacademy pro

Footer

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

info@gitopscentral.com


+91 8341443220

© Copyright 2016-2024 gitopscentral · All Rights Reserved ·