CKA

Service Accounts

백셀건전지 2021. 10. 16. 12:24
  • User Account: 말 그대로 사용자
  • Service Account: 외부 application에서 kubernetes api 호출할 때 (ex: prometheus) 사용하는 권한
  • kubectl create serviceaccount dashboard-sa
  • kubectl get serviceacccount
  • kubectl describe serviceaccount dashboard-sa
  • service account를 생성하면 service account token도 Secret로 함께 생성된다.
  • kubectl describe secret dashboard-sa-token-kbbdm
  • 이 token값을 외부 api application에다가 저장하여 호출할 때 헤더로 붙여서 사용하면 접근 가능
  • 만약 third party application이 cluster 내부에 pod로 떠있다면? 자동적으로 volume mount가 됨
  • pod를 만들고 describe를 해보면 자동적으로 Mount에 default service account가 마운트되어 있는것을 확인할 수 있음. 다만 default service account는 제한적인 기능밖에 하지 못함.
  • pod가 default외에 다른 service account를 사용하게 하고 싶다면, spec.serviceAccountName에 SA 이름 추가함
  • pod 생성시에 자동으로 default SA 추가안하고자 한다면, spec.automountServiceAccountToken: false 라고 값을 주면 됨

'CKA' 카테고리의 다른 글

Security Contexts  (0) 2022.02.10
Image Security  (0) 2022.02.10
Authentication  (0) 2021.10.16
API Group  (0) 2021.09.29
KubeConfig  (0) 2021.09.27