cprayer
May 3, 2020 - 2 min read
kubectl create secret tls ${secret-tls-name} --key ${tls-key} --cert ${tls-cert} -n ${namespace} --save-config
kubectl create secret tls ${secret-tls-name} --key ${tls-key} --cert ${tls-cert} -n ${namespace} --dry-run=client -o yaml > secret.yaml
kubectl create secret tls ${secret-tls-name} --key ${tls-key} --cert ${tls-cert} -n ${namespace} --dry-run=client -o yaml | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: example-secret-tls
data:
tls.crt: # base64 encoded cert
tls.key: # base64 encoded key
type: kubernetes.io/tls
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
spec:
tls:
- hosts:
- example.foo.com
secretName: example-secret-tls
rules:
- host: example.foo.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bar
port:
number: 80
kubectl create secret tls ${secret-tls-name} --key ${tls-key} --cert ${tls-cert} -n ${namespace} --save-config`
kubectl create secret tls ${secret-tls-name} --key ${tls-key} --cert ${tls-cert} -n ${namespace} --dry-run -o yaml | kubectl apply -f -