Generate Let'sEncrypt certificate on Kubernetes
yaml file:
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: deploy-production
spec:
acme:
# You must replace this email address with your own.
# Let's Encrypt will use this to contact you about expiring
# certificates, and issues related to your account.
email: name.surname@email.com
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
# Secret resource that will be used to store the account's private key.
name: deploy-production
# Add a single challenge solver, HTTP01 using nginx
solvers:
- http01:
ingress:
class: nginx
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: www.website.com
spec:
secretName: www.website.com.tls.prod
issuerRef:
name: deploy-production
kind: ClusterIssuer
commonName: www.website.com
dnsNames:
- www.website.com
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: deploy-production
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
generation: 2
name: nginx-ingress
spec:
rules:
- host: www.website.com
http:
paths:
- backend:
service:
name: service-clusterip-nginx
port:
number: 80
path: /
pathType: Prefix
tls:
- hosts:
- www.website.com
secretName: www.website.com.tls.prod
Commenti
Posta un commento