How to use Letsencrypt
1.Install Cert-manager
https://cert-manager.io/docs/installation/
Bash
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml
2.Install Nginx ingress
https://kubernetes.github.io/ingress-nginx/deploy/
Bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml
3.Install Issuer
YAML
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt
spec:
acme:
# server: https://acme-staging-v02.api.letsencrypt.org/directory # stage - good for testing
server: https://acme-v02.api.letsencrypt.org/directory
email: [email protected]
privateKeySecretRef:
name: letsencrypt
solvers:
- http01:
ingress:
class: nginx
4.Install Ingress resource
YAML
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-resource
annotations:
cert-manager.io/cluster-issuer: letsencrypt
spec:
ingressClassName: nginx
tls:
- hosts:
- test.urdomain.dev
secretName: letsencrypt
rules:
- host: test.urdomain.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 80