환경
- Ubuntu 20.04.6 LTS
- Kubernetes 1.26.1
증상
- Service Account를 생성해도 Secret이 생성되지 않음
원인
- Service Account 생성시 자동으로 생성되는 Token이 Kubernetes 1.24 버전 이후로는 생성되지 않음
- 따라서, Service Account 생성 시 따로 해당 Service Account의 Secret을 생성해 주어야 함
예제 YAML
--- #Service Account가 속할 Namespace 생성
apiVersion: v1
kind: Namespace
metadata:
name: test
--- #Service Account 생성
apiVersion: v1
kind: ServiceAccount
metadata:
name: test-account
namespace: test
--- #Service Account의 Secret 생성
apiVersion: v1
kind: Secret
metadata:
name: test-account-token
namespace: test
annotations:
kubernetes.io/service-account.name: test-account
type: kubernetes.io/service-account-token
생성된 Service Account Secret의 Token값은 아래 명령어를 통해 조회가 가능
kubectl describe secret test-account-token -n test
#kubectl describe secret [Secret의 이름] -n [해당 Secret이 속한 Namespace의 이름)
'System > Troubleshooting' 카테고리의 다른 글
[Ubuntu 22.04] 0% Waiting for headers - 해결됨 (0) | 2025.02.16 |
---|---|
[Kubernetes] crictl 명령어 실행 문제 - 해결됨 (0) | 2024.02.14 |
[Prometheus] Target 비활성화 문제 - 해결 (4) | 2023.10.22 |
[Ansible] kubectl 명령어 실행 문제 - 해결 (1) | 2023.08.15 |