Kubernetes Authentication
Kubernetes Authentication, Authorization
Last updated
Was this helpful?
Kubernetes Authentication, Authorization
Last updated
Was this helpful?
๋ณด์๊ด๋ฆฌ ๋ณดํต 2๊ฐ์ง๊ฐ ์๋ค. ํด๋ผ์ด์ธํธ ์ ์ ํ๊ฐ ๊ด๋ฆฌํ๋ ์ธ์ฆ๊ด๋ฆฌ์ ์ ์์ด ํ๊ฐ๋ ํด๋ผ์ด์ธํธ์ ๋ํ ๋ฆฌ์์ค ์ ๊ทผ ๊ถํ์ ๊ด๋ฆฌํ๋ ๊ถํ ๊ด๋ฆฌ๊ฐ ์๋ค.
์ฟ ๋ฒ๋คํฐ์ค์์ ์ธ์ฆ๋ฐฉ๋ฒ์ผ๋ก kubeconfig ํ์ผ๋ก ์ธ์ฆ, ServiceAccount Token์ ์ด์ฉํ ์ธ์ฆ, ์ปจํ ์ด๋์ ๊ฐ์ง๊ณ ์๋ Token์ ์ด์ฉํ ์ธ์ฆ, idP๋ฅผ ํตํ ์ธ์ฆ์ด ์๋ค.
kubectl๋ก API๋ฅผ ํธ์ถํ ๋, kubeconfig ํ์ผ๋ก ์ธ์ฆํ๊ณ ํด๋ฌ์คํฐ์ ์ ๊ทผํ ์ ์๋ค.
ํ๋๊ฐ API๋ฅผ ํธ์ถํ ๋ ServiceAccount ํ ํฐ์ ์ด์ฉํ์ฌ ์ธ์ฆํ๋ค.
์ฟ ๋ฒ๋คํฐ์ค ํด๋ผ์ด์ธํธ๋ฅผ ์ฌ์ฉํ ๋, ํ๋ ๋ด ์ปจํ ์ด๋์ ์์นํ ํ ํฐ์ ์ด์ฉํ์ฌ ์ธ์ฆํ๋ค.
์ฟ ๋ฒ๋คํฐ์ค๋ ์ฌ์ฉ์๋ฅผ API๋ก ์ง์ ๊ด๋ฆฌํ์ง ์๊ณ Dex์ ์ฐ๊ณํ์ฌ ๊ธฐ์กด ์์คํ (LDAP ๋ฑ)์ ํ์ฉํ์ฌ ์ธ์ฆํ ์ ์๋ค. Dex๋ ์๋ํํฐ๋ก ๋ถํฐ OAuth ์ธ์ฆ์ ๊ด๋ฆฌํ๋ ๋๊ตฌ์ด๋ค. Dex๋ OAuth ์๋ํํฐ์์ ์ค๊ฐ ๋งค๊ฐ์ฒด ์ญํ ์ ํด์ฃผ๊ธฐ ๋๋ฌธ์ OAuth์ ์ธ์ฆ ํ ํฐ ๋ฐ๊ธ, ์ ์ฅ ๋ฐ ๊ด๋ฆฌ๋ฅผ ์ข๋ ์ฝ๊ฒ ํ ์ ์๋ค.
์ฟ ๋ฒ๋คํฐ์ค๋ RBAC์ ์ฌ์ฉํ์ฌ ๋ฆฌ์์ค ๊ถํ์ ๊ด๋ฆฌํ๋ค. ์ด์นด์ดํธ๋ ์ ์ ์ด์นด์ดํธ์ ์์คํ ์ด์นด์ดํธ๋ก ๊ตฌ๋ถ๋๋๋ฐ, ์ ์ ์ด์นด์ดํธ๋ User์ User๋ฅผ ๋ฌถ์ Group์ผ๋ก ์ ์ํ๊ณ , ์์คํ ์ด์นด์ดํธ๋ ServiceAccount ๋ก ์ ์ํ๋ค. ์ด์นด์ดํธ์ ๋ฆฌ์์ค ๊ถํ(์, Pod - create/list/delete)์ Role์ ์ ์ํ๋ฉฐ, Role์ ์ด์นด์ดํธ์ ๋ถ์ฌํ ๋ RoleBinding์ ์ค์ ํ๋ค.
Role์ ์ ์ฉ ๋ฒ์์ ๋ฐ๋ผ ClusterRole๊ณผ Role๋ก ๊ตฌ๋ถํ๋ค. ClusterRole์ ํด๋ฌ์คํฐ ์ ์ฒด ๋ฆฌ์์ค ๊ถํ์ ์ ์ํ๊ณ , Role์ ํน์ ๋ค์์คํ์ด์ค ๋ด์ ๋ฆฌ์์ค ๊ถํ์ ์ ์ํ๋ค.
์ฟ ๋ฒ๋คํฐ์ค๋ namespace๋ฅผ ์ฌ์ฉํ์ฌ ๋ฆฌ์์ค๋ฅผ ๊ฒฉ๋ฆฌํ๊ณ , ํด๋ฌ์คํฐ ๋ด์์ ์ฌ๋ฌ ์ฌ์ฉ์๋ค ์์์ ๊ตฌ๋ถํด์ ๋๋ ์ธ ์ ์๋ค. ๋์ผํ namespace ๋ด์์ ๋ฆฌ์์ค๋ ๋ ์ด๋ธ์ ์ฌ์ฉํ์ฌ ๊ตฌ๋ถํ๋ค.
https://lcc3108.github.io/articles/2020-12/Istio+Dex-์ธ์ฆ Istio Usage in Kubeflow, https://www.kubeflow.org/docs/other-guides/istio-in-kubeflow/ https://speakerdeck.com/chanyilin/authz?slide=15 https://speakerdeck.com/chanyilin/authz?slide=12 https://medium.com/kubeflow/enabling-kubeflow-with-enterprise-grade-auth-for-on-premise-deployments-ae7dd13a69e5 https://waspro.tistory.com/608 https://bcho.tistory.com/1272