I have the following in my ingress
spec:
tls:
- hosts:
- domain.com
- www.domain.com
secretName: secret-prod
- stage.domain.com
- www.stage.domain.com
secretName: secret-stage
The format for this I've copied from various examples, but it throws the following error when I try to apply the file in kubectl
error: error parsing nginx/ingress.yml: error converting YAML to JSON: yaml: line 13: did not find expected key
Line 13 is where it says secretName: secret-prod
What's wrong with this format?
You need to separate them like that:
tls:
- secretName: secret-prod
hosts:
- domain.com
- www.domain.com
- secretName: secret-stage
hosts:
- stage.domain.com
- www.stage.domain.com
See https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/examples/multi-tls/multi-tls.yaml for a complete example.