Cloud Service Mesh 1.5 이상에서는 자동 상호 TLS(자동 mTLS)가 기본적으로 사용 설정됩니다. 자동 mTLS를 사용하면 클라이언트 사이드카 프록시가 서버에 사이드카가 있는지 자동으로 감지합니다. 클라이언트 사이드카는 사이드카가 있는 워크로드에는 mTLS를 전송하고, 사이드카 없는 워크로드에는 일반 텍스트를 전송합니다. 하지만 서비스는 일반 텍스트와 mTLS 트래픽을 모두 수락합니다. 포드에 사이드카 프록시를 삽입할 때에도 mTLS 트래픽만 허용하도록 서비스를 구성하는 것이 좋습니다.
Cloud Service Mesh를 사용하면 PeerAuthentication 정책을 적용하여 mTLS만 수락하도록 서비스를 구성할 수 있습니다. Cloud Service Mesh는 전체 서비스 메시, 네임스페이스, 개별 워크로드에 정책을 적용할 수 있는 유연성을 제공합니다. 특정 워크로드에 정책을 지정하면 해당 정책이 우선 적용됩니다. 예를 들어 워크로드별 정책이 네임스페이스별 정책보다 우선 적용됩니다. 워크로드에 지정된 정책이 없으면 네임스페이스 또는 메시의 정책을 상속합니다.
네임스페이스당 상호 TLS 사용 설정
특정 네임스페이스 내의 모든 워크로드에 mTLS를 사용 설정하려면 네임스페이스 전체 인증 정책을 사용합니다. metadata에서 적용되는 네임스페이스를 지정합니다.
peerauthentication.security.istio.io/AUTH_POLICY_NAME created
워크로드당 상호 TLS 사용 설정
특정 워크로드의 PeerAuthentication 정책을 설정하려면 selector 섹션을 구성하고 원하는 워크로드와 일치하는 라벨을 지정해야 합니다.
하지만 Cloud Service Mesh는 아웃바운드 mTLS 트래픽에 대한 워크로드 수준 정책을 서비스로 집계할 수 없습니다. 이 동작을 관리하려면 대상 규칙을 구성해야 합니다.
destinationrule.networking.istio.io/WORKLOAD created
메시 전체 mTLS 적용
메시의 모든 서비스가 일반 텍스트 트래픽을 수락하지 않도록 하려면 mTLS 모드를 STRICT(기본값은 PERMISSIVE)로 설정하여 메시 전체 PeerAuthentication 정책을 설정합니다. 메시 전체 PeerAuthentication 정책은 선택기가 없어야 하며 루트 네임스페이스 istio-system에 적용되어야 합니다. 정책을 배포하면 워크로드가 서로 인증할 수 있도록 컨트롤 플레인이 TLS 인증서를 자동으로 프로비저닝합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["Configure transport security\n\nIn Cloud Service Mesh 1.5 and later, auto\n[mutual TLS](/service-mesh/v1.20/docs/glossary#mutual_tls) (auto mTLS) is enabled by\ndefault. With auto mTLS, a client sidecar proxy automatically detects if the\nserver has a sidecar. The client sidecar sends mTLS to workloads with sidecars\nand sends plaintext to workloads without sidecars. Note, however, services\n*accept* both plaintext and mTLS traffic. As you\n[inject sidecar proxies](/service-mesh/v1.20/docs/anthos-service-mesh-proxy-injection) to\nyour Pods, we recommend that you also configure your services to only accept\nmTLS traffic.\n\nWith Cloud Service Mesh, you can configure your services to only accept mTLS by\napplying a `PeerAuthentication` policy. Cloud Service Mesh gives you the flexibility\nto apply the policy to the entire service mesh, to a namespace, or to an\nindividual workload. When you specify a policy for a specific workload, that\npolicy takes precedence. For example, a workload-specific policy takes\nprecedence over a namespace-specific one. If no policy is specified for the\nworkload, it inherits the policy from the namespace or the mesh.\n\nEnable mutual TLS per namespace\n\nTo enable mTLS for all workloads within a particular namespace, use a\nnamespace-wide authentication policy. You specify the namespace it applies to\nunder `metadata`. \n\n kubectl apply -f - \u003c\u003cEOF\n apiVersion: \"security.istio.io/v1beta1\"\n kind: \"PeerAuthentication\"\n metadata:\n name: \"\u003cvar translate=\"no\"\u003eAUTH_POLICY_NAME\u003c/var\u003e\"\n namespace: \"\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\"\n spec:\n mtls:\n mode: STRICT\n EOF\n\nExpected output: \n\n```\npeerauthentication.security.istio.io/AUTH_POLICY_NAME created\n```\n\n\u003cbr /\u003e\n\nEnable mutual TLS per workload\n\nTo set a `PeerAuthentication` policy for a specific workload, you must configure\nthe `selector` section and specify the labels that match the desired workload.\nHowever, Cloud Service Mesh can't aggregate workload-level policies for outbound\nmTLS traffic to a service. You need to configure a destination rule to manage\nthat behavior.\n\n1. Apply an authentication policy to a specific workload in your namespace:\n\n cat \u003c\u003cEOF | kubectl apply -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e -f -\n apiVersion: \"security.istio.io/v1beta1\"\n kind: \"PeerAuthentication\"\n metadata:\n name: \"\u003cvar translate=\"no\"\u003eAUTH_POLICY_NAME\u003c/var\u003e\"\n namespace: \"\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\"\n spec:\n selector:\n matchLabels:\n app: \u003cvar translate=\"no\"\u003eWORKLOAD\u003c/var\u003e\n mtls:\n mode: STRICT\n EOF\n\n Expected output: \n\n ```\n peerauthentication.security.istio.io/AUTH_POLICY_NAME created\n ```\n2. Configure a matching destination rule:\n\n cat \u003c\u003cEOF | kubectl apply -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e -f -\n apiVersion: \"networking.istio.io/v1alpha3\"\n kind: \"DestinationRule\"\n metadata:\n name: \"\u003cvar translate=\"no\"\u003eDEST_RULE_NAME\u003c/var\u003e\"\n spec:\n host: \"\u003cvar translate=\"no\"\u003eWORKLOAD\u003c/var\u003e.\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e.svc.cluster.local\"\n trafficPolicy:\n tls:\n mode: ISTIO_MUTUAL\n EOF\n\n Expected output: \n\n ```\n destinationrule.networking.istio.io/WORKLOAD created\n ```\n\nEnforce mesh-wide mTLS\n\nTo prevent all your services in the mesh from accepting plain-text traffic, set\na mesh-wide `PeerAuthentication` policy with the mTLS mode set to `STRICT` (the\ndefault is `PERMISSIVE`). The mesh-wide `PeerAuthentication` policy shouldn't\nhave a selector and must be applied in the root namespace, `istio-system`. When\nyou deploy the policy, the control plane automatically provisions TLS\ncertificates so that workloads can authenticate with each other.\n\nTo enforce mesh-wide mTLS: \n\n kubectl apply -f - \u003c\u003cEOF\n apiVersion: \"security.istio.io/v1beta1\"\n kind: \"PeerAuthentication\"\n metadata:\n name: \"\u003cvar translate=\"no\"\u003eAUTH_POLICY_NAME\u003c/var\u003e\"\n namespace: \"istio-system\"\n spec:\n mtls:\n mode: STRICT\n EOF\n\nExpected output: \n\n```\npeerauthentication.security.istio.io/AUTH_POLICY_NAME created\n```\n\n\u003cbr /\u003e\n\nFind and delete `PeerAuthentication` policies\n\nFor a list of all the `PeerAuthentication` policies in the service mesh: \n\n kubectl get peerauthentication --all-namespaces\n\nIf there is a `PeerAuthentication` policy in force, you can delete it with\n`kubectl delete`: \n\n kubectl delete peerauthentication -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \u003cvar translate=\"no\"\u003eAUTH_POLICY_NAME\u003c/var\u003e\n\nWhat's next\n\n- [Cloud Service Mesh by example: mTLS](/service-mesh/v1.20/docs/by-example/mtls)\n- [Learn about security in Cloud Service Mesh](/service-mesh/v1.20/docs/security/security-overview)"]]