1.2. 네임스페이스에서 보안 공유
클러스터의 네임스페이스에서 보안을 공유하려면 Secret
오브젝트에 대한 SharedSecret
CR(사용자 정의 리소스) 인스턴스를 생성합니다.
사전 요구 사항
-
다른 네임스페이스에서 공유할
Secret
오브젝트를 생성했습니다. 다음 작업을 수행할 수 있는 권한이 있어야 합니다.
- 클러스터에 가입하고 Insights Operator를 통해 인타이틀먼트 키를 동기화해야 합니다.
-
클러스터 범위 수준에서
sharedsecrets.sharedresource.openshift.io
CRD(사용자 정의 리소스 정의)의 인스턴스를 생성했습니다. -
SharedConfigMap CR
에 대한ClusterRole
오브젝트를 생성하셨습니다. -
공유 리소스 CSI 드라이버에 대한
Role
및RoleBinding
오브젝트를 생성하셨습니다. - 사용자를 제어하기 위해 클러스터의 네임스페이스에서 관리되는 역할 및 역할 바인딩입니다.
-
Pod에서 지정한 서비스 계정이 사용하려는
Secret
또는Configmap
CR을 참조하는 CSI(Container Storage Interface) 볼륨을 마운트할 수 있는지 여부를 제어하는 관리 역할 및 역할 바인딩입니다. - 공유할 시크릿이 포함된 네임스페이스에 액세스할 수 있습니다.
프로세스
다음 예제 구성을 사용하여 클러스터의 네임스페이스에서 참조된 보안을 공유할
Shared
인스턴스를 생성합니다.Secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: sharedresource.openshift.io/v1alpha1 kind: SharedSecret metadata: name: shared-test-secret spec: secretRef: name: test-secret namespace: <name_of_the_source_namespace>
apiVersion: sharedresource.openshift.io/v1alpha1 kind: SharedSecret metadata: name: shared-test-secret
1 spec: secretRef: name: test-secret namespace: <name_of_the_source_namespace>
- 1
SharedSecret
CR의 이름을 정의합니다.
다음 예제 구성을 사용하여 참조된 공유 리소스를 사용할 수 있는 RBAC 권한을 부여하는
ClusterRole
오브젝트를 생성합니다.Copy to Clipboard Copied! Toggle word wrap Toggle overflow . apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: use-shared-test-secret rules: - apiGroups: - sharedresource.openshift.io resources: - sharedsecrets resourceNames: - shared-test-secret verbs: - use
. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: use-shared-test-secret
1 rules: - apiGroups: - sharedresource.openshift.io resources: - sharedsecrets resourceNames: - shared-test-secret verbs: - use
- 1
ClusterRole
CR의 이름을 정의합니다.
Shared Resources CSI 드라이버에
SharedSecret
오브젝트에 액세스할 수 있는 권한을 부여하는Role
및RoleBinding
오브젝트를 생성합니다.Role
오브젝트의 예Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: share-etc-pki-entitlement namespace: openshift-config-managed rules: - apiGroups: - "" resources: - secrets resourceNames: - etc-pki-entitlement verbs: - get - list - watch
apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: share-etc-pki-entitlement
1 namespace: openshift-config-managed rules: - apiGroups: - "" resources: - secrets resourceNames: - etc-pki-entitlement verbs: - get - list - watch
- 1
Role
CR의 이름을 정의합니다.
RoleBinding
오브젝트의 예Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: share-etc-pki-entitlement namespace: openshift-config-managed roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: share-etc-pki-entitlement subjects: - kind: ServiceAccount name: csi-driver-shared-resource namespace: openshift-builds
apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: share-etc-pki-entitlement
1 namespace: openshift-config-managed roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: share-etc-pki-entitlement
2 subjects: - kind: ServiceAccount name: csi-driver-shared-resource
3 namespace: openshift-builds