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

后端 未结 2 994
无人及你
无人及你 2020-12-18 11:30

I need to setup mutual tls communication from kubernetes pod to external service. My system is running with istio system.

I found reference about this.

https

相关标签:
2条回答
  • 2020-12-18 11:39

    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.

    0 讨论(0)
  • 2020-12-18 11: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

    0 讨论(0)
提交回复
热议问题