How can I use custom client certificate for external service with istio?

无人久伴 提交于 2019-12-01 12:54:50

You can run istioctl kube-inject -f your-deployment.yaml > your-deployment-with-istio-sidecar.yaml.

Then edit your-deployment-with-istio-sidecar.yaml and add mounting of the certificates from some secrets. Then create the secrets from your certificates.

Alternatively, create your sidecar injection template, see https://istio.io/blog/2019/data-plane-setup/#manual-injection.

Example of creating secrets for certificates: https://istio.io/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/#redeploy-the-egress-gateway-with-the-client-certificates

Mounting volumes from secretes described here https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod

chaeyk

I found solution.

  1. create secret or config map
kubectl create secret generic my-cert --from-file=cert1.crt --from-file=cert2.crt
  1. annotate pod or deployment with sidecar.istio.io/userVolumeMount, sidecar.istio.io/userVolume
annotations:                                                                                       
  sidecar.istio.io/userVolumeMount: '[{"name":"my-cert", "mountPath":"/etc/my-cert", "readonly":true}]'
  sidecar.istio.io/userVolume: '[{"name":"my-cert", "secret":{"secretName":"my-cert"}}]'

Documentation on these and other annotations: https://preliminary.istio.io/docs/reference/config/annotations/

Done. It's mounted to envoy proxy pod.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!