approver-policy 설치
approver-policy를 설치하는 방법을 안내해 드릴게요. 설치 전에 cert-manager가 설치되어 있고 기본 approver가 비활성화되어 있어야 해요.
출처: 문서
본문
설치 단계
1. cert-manager 설치
cert-manager가 설치되고(/docs/installation/), cert-manager의 기본 approver가 비활성화되어야 해요(/docs/usage/certificaterequest/#approver-controller).
⚠️ cert-manager에서 기본 approver를 비활성화하지 않으면, approver-policy가 cert-manager와 경쟁하게 되어 정책이 효력을 발휘하지 못해요.
helm install이나 helm upgrade로 cert-manager를 설치한다면, --set 또는 --values 커맨드 라인 플래그를 사용해 설치 전에 차트 사용자 지정하기를 통해 기본 approver를 비활성화할 수 있어요:
# ⚠️ This Helm option is only available in cert-manager v1.15.0 and later.
# Example --set value
--set disableAutoApproval=true
# ⚠️ This Helm option is only available in cert-manager v1.15.0 and later.
# Example --values file content
disableAutoApproval: true
이미 cert-manager가 설치되어 있다면, 아래 예시처럼 다시 구성해 기본 approver를 비활성화할 수 있어요. 다른 승인 방식이 구성되어 있지 않은 실행 중인 클러스터에서 이 작업을 수행하면 (인증서 요청이 승인되지 않으므로) 모든 발급이 중단된다는 점에 유의하세요!
# ⚠️ The disableAutoApproval Helm option is only available in cert-manager v1.15.0 and later.
# ⚠️ DANGER: Only do this in a cluster if you're sure it's safe!
existing_cert_manager_version=$(helm get metadata -n cert-manager cert-manager | grep '^VERSION' | awk '{ print $2 }')
helm upgrade cert-manager oci://quay.io/jetstack/charts/cert-manager \
--reuse-values \
--namespace cert-manager \
--version $existing_cert_manager_version \
--set disableAutoApproval=true
2. approver-policy 설치
approver-policy를 설치하려면:
helm upgrade cert-manager-approver-policy oci://quay.io/jetstack/charts/cert-manager-approver-policy \
--install \
--namespace cert-manager \
--wait
approver-policy를 외부 issuer(/docs/configuration/issuers/)와 함께 사용한다면, approver-policy가 이를 참조하는 CertificateRequest를 승인하고 거부할 권한을 갖도록 그들의 signer 이름을 포함해야 해요(/docs/usage/certificaterequest/#rbac-syntax). 예를 들어, 내장 issuer 유형에 대해 approver-policy를 사용하고 google-cas-issuer(https://github.com/jetstack/google-cas-issuer)와 aws-privateca-issuer(https://github.com/cert-manager/aws-privateca-issuer)도 함께 사용한다면, 설치 시 다음 값을 설정하세요:
helm upgrade cert-manager-approver-policy oci://quay.io/jetstack/charts/cert-manager-approver-policy \
--install \
--namespace cert-manager \
--wait \
--set app.approveSignerNames="{\
issuers.cert-manager.io/*,clusterissuers.cert-manager.io/*,\
googlecasclusterissuers.cas-issuer.jetstack.io/*,googlecasissuers.cas-issuer.jetstack.io/*,\
awspcaclusterissuers.awspca.cert-manager.io/*,awspcaissuers.awspca.cert-manager.io/*\
}"
제거 (Uninstalling)
Helm으로 설치된 approver-policy를 제거하려면:
$ helm uninstall cert-manager-approver-policy --namespace cert-manager
These resources were kept due to the resource policy:
[CustomResourceDefinition] certificaterequestpolicies.policy.cert-manager.io
release "cert-manager-approver-policy" uninstalled
출력에서 볼 수 있듯이 CertificateRequestPolicy의 CustomResourceDefinition은 Helm uninstall 명령으로 제거되지 않아요. 이는 CustomResourceDefinition을 제거하면 모든 CertificateRequestPolicy 리소스도 함께 제거되므로 데이터 손실을 방지하기 위해서예요.
☢️ 다음은 클러스터에서 모든 CertificateRequestPolicy 리소스를 제거합니다:
$ kubectl delete crd certificaterequestpolicies.policy.cert-manager.io
⚠️ v0.13.0 이전 버전의 approver-policy는 제거 시 CustomResourceDefinition을 보존하지 않으며 클러스터에서 모든 CertificateRequestPolicy 리소스를 제거해요. v0.13.0 이전 버전을 사용 중이라면 제거 전에 CertificateRequestPolicy 리소스를 반드시 백업하세요. 또는 제거 전에 v0.13.0으로 업그레이드하세요.
사용법 (Usage)
📖 approver-policy 문서를 읽어 보세요.
더 알아보기 (Learn more)
- cert-manager 공식 문서: Installing approver-policy
- approver-policy 사용법: approver-policy