Installation Certificat SSL sur un load-balancer Kubernetes
... / Installation Certificat S...
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
question

Installation Certificat SSL sur un load-balancer Kubernetes

Par
BenjaminM22
Créé le 2019-12-05 12:58:32 (edited on 2024-09-04 12:50:41) dans Certificats SSL

Bonjour à tous,
je vous préviens je suis plus dev que ops :)
Alors pour faire quelques tests, j'ai loué une instance VPS pour créer un cluster kubernetes.
J'ai déclaré un noeud, j'ai configuré mes pods et mon service tout bien comme il faut avec le yml, j'ai connecté mon déploiement avec mon repo privé Docker, tout fonctionne, mon image monte, elle est déployée sur mes pods c'est génial :) j'y accède bien via Internet, top.

Maintenant, phase 2 : sécurisation et installation d'un certificat SSL pour le load-balancer K8s. Et là rien dans la doc :( j'ai beau fouiller dans les menus, je ne vois pas la capacité d'installer un de mes certificats sur le load-balancer (qui est créé automatiquement par OVH si j'ai bien compris).
D'ailleurs je ne vois aucun load-balancer déclaré dans mon interface Public Cloud.

Donc je vous pose la question : est-ce que vous auriez des informations à ce sujet s'il vous plait ?
En vous remerciant par avance pour votre aide !


1 réponse ( Latest reply on 2021-01-23 16:07:06 Par
JohannR3
)

Bon je vais tenter de répondre tout seul :)
apparemment il faudrait que j'utilise ingress avec le SSL, quelqu'un peut confirmer s'il vous plait ?

Bonjour,

Je confirme.
J'ai suivi cette documentation avec quelques petits ajustements pour mon cas : https://1chambon.medium.com/automatic-certificate-generation-on-kubernetes-with-cert-manager-on-ovh-cloud-a0b58b64279bchambon.medium.com/automatic-certificate-generation-on-kubernetes-with-cert-manager-on-ovh-cloud-a0b58b64279b

Les étapes suivies :
1. Installation de CertManager avec Helm
2. création d'un objet K8S de type ClusterIssuer : celui-ci utilise CertManager et fournit un certificat depuis letsencrypt.org
2.1 je passe par une validation HTTP pour letsencrypt plutôt que DNS comme dans la doc (je n'ai pas trouvé comment configurer le DNS dans Ovh Cloud Web)
3. création d'un objet K8S de type Certificat
4. Création d'un Ingress nginx qui fait appel au ClusterIssuer pour récupérer le certificat

Voici les Manifest :
> apiVersion: networking.k8s.io/v1
> kind: Ingress
> metadata:
> annotations:
> kubernetes.io/ingress.class: nginx
> cert-manager.io/cluster-issuer: "letsencrypt-staging"
> name: example-ingress
> namespace: default
> spec:
> rules:
> - host: {{nomdedomaine}}
> http:
> paths:
> - path: /
> pathType: Prefix
> backend:
> service:
> name: {{nomduservice}}
> port:
> number: 80
> tls:
> - hosts:
> - {{nomdedomaine}}
> secretName: letsencrypt-staging

> apiVersion: cert-manager.io/v1alpha2
> kind: ClusterIssuer
> metadata:
> name: letsencrypt-staging # Name of the issuer
> labels:
> app.kubernetes.io/name: example-issuer
> app.kubernetes.io/tier: backend
> app.kubernetes.io/managed-by: Ops
> spec:
> acme:
> server: https://1v02.api.letsencrypt.org/directoryv02.api.letsencrypt.org/directory # URL of the server
> email: #email of the user that will the notification about the cert
> privateKeySecretRef:
> name: letsencrypt-staging
> solvers:
> - http01:
> ingress:
> class: nginx
> ---
> apiVersion: cert-manager.io/v1alpha2
> kind: Certificate
> metadata:
> name: custom-certificate-name
> spec:
> dnsNames:
> - {{nomdedomaine}} # name of the domain you want to validate the certificate
> commonName: {{nomdedomaine}} # ???
> issuerRef:
> name: letsencrypt-staging # name of the issuer you created before
> kind: ClusterIssuer
> secretName: letsencrypt-staging # name of the secret that will be created that will contain the certificate