GKE 레거시 클라이언트 인증서 인증

GKE에서 권장 인증 방식을 사용하고 기존 레거시 클라이언트 인증서의 권한을 관리하는 방법을 설명합니다.

설명

google.cloud.gcp_container_cluster의 master_auth.client_certificate_config.issue_client_certificate는 클러스터 생성 시 레거시 클라이언트 인증서를 발급할지 정합니다. API 서버의 TLS 인증서 검증은 그대로 유지됩니다.

잠재적 영향

인증서와 개인 키가 함께 유출되면 해당 주체에 부여된 클러스터 권한을 다른 사람이 사용할 수 있습니다.

해결 방법

운영자와 자동화를 OAuth로 옮기고 kubectl에는 GKE 인증 플러그인을 구성하세요. 필요한 IAM·RBAC 권한만 부여하세요. 기존 클러스터의 인증서는 발급 설정으로 폐기할 수 없습니다. RBAC를 적용해 인증서의 권한을 제거하고, 기존 ABAC로 허용되는 작업이 없는지 확인하세요. 필요한 운영 작업도 다시 시험하세요.

예시

두 예시의 username과 password는 기본 인증에 사용하던 필드입니다. GKE 1.19부터 이 인증 방식은 지원되지 않습니다. 현재 환경에는 실제 프로젝트와 서비스 계정 JSON 파일 경로를 지정하고 지원되는 인증 방식을 사용하세요.

발급을 비활성화한 설정

yaml
- name: create a cluster3
  google.cloud.gcp_container_cluster:
    name: my-cluster3
    initial_node_count: 2
    master_auth:
      username: cluster_admin
      password: my-secret-password
      client_certificate_config:
        issue_client_certificate: no
    node_config:
      machine_type: n1-standard-4
      disk_size_gb: 500
    location: us-central1-a
    project: test_project
    auth_kind: serviceaccount
    service_account_file: "/tmp/auth.pem"
    state: present

my-cluster3는 issue_client_certificate: no로 생성 시 발급을 끕니다.

발급을 활성화한 이전 설정

yaml
- name: create a cluster
  google.cloud.gcp_container_cluster:
    name: my-cluster
    initial_node_count: 2
    master_auth:
      username: cluster_admin
      password: my-secret-password
      client_certificate_config:
        issue_client_certificate: yes
    node_config:
      machine_type: n1-standard-4
      disk_size_gb: 500
    location: us-central1-a
    project: test_project
    auth_kind: serviceaccount
    service_account_file: /tmp/auth.pem
    state: present

다른 클러스터인 my-cluster는 issue_client_certificate: yes로 기존 방식의 인증서를 요청합니다.

참조