Search code examples
kuberneteshaproxytraefiklets-encrypt

Access https backend with ingress and traefik


I am trying to use 'Kubernetes Ingress with Traefik, CertManager, LetsEncrypt and HAProxy' for certificates management.

What I want to do is use certificates in my application which deployed on kubernetes.

My application contains following services:

my-app1 NodePort 10.43.204.206 16686:31149/TCP

my-app2 NodePort 10.43.204.208 2746:30972/TCP

So for my-app1 without certificates I was accessing it as http://{IP}:31149/app1. And with certificates I am now accessing it as https://my-dns.com/app1. For this I am using this link. I created following ingress resource:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: prod-ingress
  namespace: my-ns
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  tls:
  - hosts:
    - "my-dns.com"
    secretName: prod-cert
  rules:
  - host: "my-dns.com"
    http:
      paths:
      - path: /app1
        pathType: Prefix
        backend:
          service:
            name: my-app1
            port:
              number: 16686

But for my-app2 without certificates I was accessing it as https://{IP}:30972/app2. So as I am already using https for my-app2 but I want to also use certificates for this service.

Any idea how to do this?


Solution

  • So the issue was, I was deploying my application with self signed certificates. So because of this I am getting issue while accessing my dashboard.

    So now I just disabled self signed certificates in my application. And now I am able to access dashboard with domain name https://my-dns.com.