5장. OpenShift Service Mesh 및 cert-manager
cert-manager 툴은 Kubernetes에서 X.509 인증서 관리를 위한 솔루션입니다. Vault, Google Cloud Certificate Authority Service, Let's Encrypt 및 기타 공급자와 같은 개인 또는 공개 키 인프라(PKI)와 애플리케이션을 통합하는 통합 API를 제공합니다.
cert-manager 툴은 만료되기 전에 구성된 시간에 인증서를 갱신하여 인증서가 유효하고 최신 상태인지 확인합니다.
Istio 리소스를 생성하고 설치하기 전에 cert-manager 툴을 설치해야 합니다.
5.1. cert-manager Operator istio-csr 에이전트 정보 링크 복사링크가 클립보드에 복사되었습니다!
cert-manager Operator for Red Hat OpenShift에 대한 Istio-csr 통합은 기술 프리뷰 기능 전용입니다. 기술 프리뷰 기능은 Red Hat 프로덕션 서비스 수준 계약(SLA)에서 지원되지 않으며 기능적으로 완전하지 않을 수 있습니다. 따라서 프로덕션 환경에서 사용하는 것은 권장하지 않습니다. 이러한 기능을 사용하면 향후 제품 기능을 조기에 이용할 수 있어 개발 과정에서 고객이 기능을 테스트하고 피드백을 제공할 수 있습니다.
Red Hat 기술 프리뷰 기능의 지원 범위에 대한 자세한 내용은 기술 프리뷰 기능 지원 범위를 참조하십시오.
cert-manager Operator for Red Hat OpenShift는 Red Hat OpenShift Service Mesh 및 Istio에서 워크로드 및 컨트롤 플레인 구성 요소를 보호하기 위해 인증서 관리를 향상시킵니다. cert-manager 발행자를 통해 mTLS(Transport Layer Security)에 사용되는 발행, 제공 및 갱신을 지원합니다.
cert-manager Operator에서 관리하는 istio-csr 에이전트와 Istio를 통합하면 Istio에서 인증서를 직접 요청하고 관리할 수 있습니다. 통합을 통해 보안 구성을 단순화하고 클러스터 내에서 인증서 관리를 중앙 집중화합니다.
Istio 리소스를 생성하고 설치하기 전에 cert-manager Operator for Red Hat OpenShift를 설치해야 합니다.
5.1.1. istio-csr 에이전트를 사용하여 cert-manager Operator와 서비스 메시 통합 링크 복사링크가 클립보드에 복사되었습니다!
istio-csr 에이전트를 배포하고 istio-csr 에이전트를 사용하여 워크로드 및 컨트롤 플레인 인증서 서명 요청을 처리하는 Istio 리소스를 구성하여 cert-manager Operator를 OpenShift Service Mesh와 통합할 수 있습니다. 다음 절차에서는 자체 서명된 발급자 오브젝트를 생성합니다.
사전 요구 사항
- cert-manager Operator for Red Hat OpenShift 버전 1.15.1을 설치했습니다.
- OpenShift Container Platform 4.14 이상에 로그인되어 있습니다.
- OpenShift Service Mesh Operator가 설치되어 있습니다.
-
클러스터에서
IstioCNI인스턴스가 실행되고 있어야 합니다. -
istioctl명령을 설치했습니다.
프로세스
다음 명령을 실행하여
istio-system네임스페이스를 생성합니다.$ oc create namespace istio-system다음 명령을 실행하여 cert-manager Operator를 패치하여
istio-csr에이전트를 설치합니다.$ oc -n cert-manager-operator patch subscription openshift-cert-manager-operator \ --type='merge' -p \ '{"spec":{"config":{"env":[{"name":"UNSUPPORTED_ADDON_FEATURES","value":"IstioCSR=true"}]}}}'istio-csr에이전트에 대한Issuer오브젝트를 생성하여 root CA(인증 기관) 발행자를 생성합니다.다음 명령을 실행하여
istio-csr에이전트를 설치하기 위한 새 프로젝트를 생성합니다.$ oc new-project istio-csr다음 예와 유사한
Issuer오브젝트를 생성합니다.참고자체 서명된발행자는 데모, 테스트 또는 개념 증명 환경을 위한 것입니다. 프로덕션 배포의 경우 안전하고 신뢰할 수 있는 CA를 사용합니다.issuer.yaml파일 예apiVersion: cert-manager.io/v1 kind: Issuer metadata: name: selfsigned namespace: istio-system spec: selfSigned: {} --- apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: istio-ca namespace: istio-system spec: isCA: true duration: 87600h secretName: istio-ca commonName: istio-ca privateKey: algorithm: ECDSA size: 256 subject: organizations: - cluster.local - cert-manager issuerRef: name: selfsigned kind: Issuer group: cert-manager.io --- apiVersion: cert-manager.io/v1 kind: Issuer metadata: name: istio-ca namespace: istio-system spec: ca: secretName: istio-ca다음 명령을 실행하여 오브젝트를 생성합니다.
$ oc apply -f issuer.yaml다음 명령을 실행하여
istio-ca인증서에 "Ready" 상태 조건이 포함될 때까지 기다립니다.$ oc wait --for=condition=Ready certificates/istio-ca -n istio-system
IstioCSR사용자 지정 리소스를 생성합니다.다음 예와 유사한
IstioCSR사용자 지정 리소스를 생성합니다.istioCSR.yaml파일 예apiVersion: operator.openshift.io/v1alpha1 kind: IstioCSR metadata: name: default namespace: istio-csr spec: istioCSRConfig: certManager: issuerRef: name: istio-ca kind: Issuer group: cert-manager.io istiodTLSConfig: trustDomain: cluster.local istio: namespace: istio-system다음 명령을 실행하여
istio-csr에이전트를 생성합니다.$ oc create -f istioCSR.yaml다음 명령을 실행하여
istio-csr배포가 준비되었는지 확인합니다.$ oc get deployment -n istio-csr
istio리소스를 설치합니다.참고이 구성은 Istio에 대한 기본 제공 CA 서버를 비활성화하고
istiod에서istio-csr에이전트로 인증서 서명 요청을 전달합니다.istio-csr에이전트는 cert-manager Operator에서istiod및 mesh 워크로드 모두에 대한 인증서를 가져옵니다.istio-csr에이전트에서 생성한istiodTLS 인증서는 사용할 알려진 위치의 포드에 마운트됩니다.다음 예와 유사한
Istio오브젝트를 생성합니다.istio.yaml파일 예apiVersion: sailoperator.io/v1 kind: Istio metadata: name: default spec: version: v1.24-latest namespace: istio-system values: global: caAddress: cert-manager-istio-csr.istio-csr.svc:443 pilot: env: ENABLE_CA_SERVER: "false"다음 명령을 실행하여
Istio리소스를 생성합니다.$ oc apply -f istio.yaml다음 명령을 실행하여
istio리소스에 "Ready" 상태 조건이 표시되는지 확인합니다.$ oc wait --for=condition=Ready istios/default -n istio-system
5.1.2. istio-csr 에이전트를 사용하여 cert-manager Operator로 서비스 메시 확인 링크 복사링크가 클립보드에 복사되었습니다!
샘플 httpbin 서비스와 sleep 애플리케이션을 사용하여 워크로드 간 트래픽을 확인할 수 있습니다. 워크로드 프록시 인증서를 확인하여 cert-manager Operator가 올바르게 설치되었는지 확인합니다.
네임스페이스를 생성합니다.
다음 명령을 실행하여
apps-1네임스페이스를 생성합니다.$ oc new-project apps-1다음 명령을 실행하여
apps-2네임스페이스를 생성합니다.$ oc new-project apps-2
네임스페이스에
istio-injection=enabled라벨을 추가합니다.다음 명령을 실행하여
apps-1네임스페이스에istio-injection=enabled레이블을 추가합니다.$ oc label namespaces apps-1 istio-injection=enabled다음 명령을 실행하여
apps-2네임스페이스에istio-injection=enabled레이블을 추가합니다.$ oc label namespaces apps-2 istio-injection=enabled
네임스페이스에
httpbin애플리케이션을 배포합니다.다음 명령을 실행하여
apps-1네임스페이스에httpbin앱을 배포합니다.$ oc apply -n apps-1 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/httpbin/httpbin.yaml다음 명령을 실행하여
apps-2네임스페이스에httpbin앱을 배포합니다.$ oc apply -n apps-2 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/httpbin/httpbin.yaml
네임스페이스에
절전애플리케이션을 배포합니다.다음 명령을 실행하여
apps-1네임스페이스에절전애플리케이션을 배포합니다.$ oc apply -n apps-1 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/sleep/sleep.yaml다음 명령을 실행하여
apps-2네임스페이스에절전애플리케이션을 배포합니다.$ oc apply -n apps-2 -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/sleep/sleep.yaml
생성된 앱에 사이드카가 삽입되었는지 확인합니다.
다음 명령을 실행하여 생성된 앱에
apps-1네임스페이스에 사이드카가 삽입되었는지 확인합니다.$ oc get pods -n apps-1다음 명령을 실행하여 생성된 앱에
apps-2네임스페이스에 사이드카가 삽입되어 있는지 확인합니다.$ oc get pods -n apps-2
다음 예와 유사한 메시 전체 mTLS(Transport Layer Security) 정책을 생성합니다.
참고엄격한 mTLS 모드에서
PeerAuthentication을 활성화하면 인증서가 올바르게 배포되고 워크로드 간에 mTLS 통신이 작동하는지 확인합니다.peer_auth.yaml예제 파일apiVersion: security.istio.io/v1beta1 kind: PeerAuthentication metadata: name: default namespace: istio-system spec: mtls: mode: STRICT다음 명령을 실행하여 mTLS 정책을 적용합니다.
$ oc apply -f peer_auth.yaml다음 명령을 실행하여
apps-1/sleep앱이apps-2/httpbin서비스에 액세스할 수 있는지 확인합니다.$ oc -n apps-1 exec "$(oc -n apps-1 get pod \ -l app=sleep -o jsonpath={.items..metadata.name})" \ -c sleep -- curl -sIL http://httpbin.apps-2.svc.cluster.local:8000출력 예
HTTP/1.1 200 OK access-control-allow-credentials: true access-control-allow-origin: * content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' camo.githubusercontent.com content-type: text/html; charset=utf-8 date: Wed, 18 Jun 2025 09:20:55 GMT x-envoy-upstream-service-time: 14 server: envoy transfer-encoding: chunked다음 명령을 실행하여
apps-2/sleep앱이apps-1/httpbin서비스에 액세스할 수 있는지 확인합니다.$ oc -n apps-2 exec "$(oc -n apps-1 get pod \ -l app=sleep -o jsonpath={.items..metadata.name})" \ -c sleep -- curl -sIL http://httpbin.apps-2.svc.cluster.local:8000출력 예
HTTP/1.1 200 OK access-control-allow-credentials: true access-control-allow-origin: * content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' camo.githubusercontent.com content-type: text/html; charset=utf-8 date: Wed, 18 Jun 2025 09:21:23 GMT x-envoy-upstream-service-time: 16 server: envoy transfer-encoding: chunked다음 명령을 실행하여
httpbin워크로드 인증서가 예상대로 일치하는지 확인합니다.$ istioctl proxy-config secret -n apps-1 \ $(oc get pods -n apps-1 -o jsonpath='{.items..metadata.name}' --selector app=httpbin) \ -o json | jq -r '.dynamicActiveSecrets[0].secret.tlsCertificate.certificateChain.inlineBytes' \ | base64 --decode | openssl x509 -text -noout출력 예
... Issuer: O = cert-manager + O = cluster.local, CN = istio-ca ... X509v3 Subject Alternative Name: URI:spiffe://cluster.local/ns/apps-1/sa/httpbin
5.1.3. istio-csr 에이전트를 사용하여 cert-manager Operator를 사용하여 서비스 메시 설치 제거 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차를 완료하여 OpenShift Service Mesh를 사용하여 cert-manager Operator를 설치 제거할 수 있습니다. 다음 리소스를 제거하기 전에 Red Hat OpenShift Service Mesh 또는 Istio 구성 요소가 Istio-CSR 에이전트를 참조하지 않는지 확인합니다. 사용 중인 동안 이러한 리소스를 제거하면 메시 기능이 중단될 수 있습니다.
프로세스
다음 명령을 실행하여
IstioCSR사용자 정의 리소스를 제거합니다.$ oc -n <istio-csr_project_name> delete istiocsrs.operator.openshift.io default관련 리소스를 제거합니다.
다음 명령을 실행하여 클러스터 scoped-resources를 나열합니다.
$ oc get clusterrolebindings,clusterroles -l "app=cert-manager-istio-csr,app.kubernetes.io/name=cert-manager-istio-csr"나중에 참조할 수 있도록 나열된 리소스의 이름을 저장합니다.
다음 명령을 실행하여
istio-csr에이전트에서 배포한 네임스페이스의 리소스를 나열합니다.$ oc get certificate,deployments,services,serviceaccounts -l "app=cert-manager-istio-csr,app.kubernetes.io/name=cert-manager-istio-csr" -n <istio_csr_project_name>나중에 참조할 수 있도록 나열된 리소스의 이름을 저장합니다.
다음 명령을 실행하여 Red Hat OpenShift Service Mesh 또는 Istio 배포된 네임스페이스의 리소스를 나열합니다.
$ oc get roles,rolebindings \ -l "app=cert-manager-istio-csr,app.kubernetes.io/name=cert-manager-istio-csr" \ -n <istio_csr_project_name>나중에 참조할 수 있도록 나열된 리소스의 이름을 저장합니다.
이전 단계에서 나열된 각 리소스에 대해 다음 명령을 실행하여 리소스를 삭제합니다.
$ oc -n <istio_csr_project_name> delete <resource_type>/<resource_name>