Killer Shell CKS - Apiserver NodeRestriction

Jmnote (토론 | 기여)님의 2025년 11월 19일 (수) 19:44 판

1 개요

Killer Shell CKS - Apiserver NodeRestriction

  • NodeRestriction 어드미션 플러그인이 활성화되어 있으면, Kubelet(주체: system:node:<노드명>, 그룹: system:nodes)은 자신(Node, 자신이 생성한 Pod) 범위를 벗어난 변경이나 특정 예약 접두어 레이블(node-restriction.kubernetes.io/*) 변경이 거부된다.
  • 본 단계의 목표는 “현재는 제한이 적용되지 않음”을 증명하는 것이다. 따라서 node01의 kubelet 신분으로 위 접두어 레이블을 추가해 보고 성공한다면, 제한이 꺼져 있음을 확인할 수 있다.
controlplane:~$ k get node
NAME           STATUS   ROLES           AGE   VERSION
controlplane   Ready    control-plane   39h   v1.34.1
node01         Ready    <none>          39h   v1.34.1

2 확인

node01 호스트에서 Kubelet 자격증명으로 API 서버에 접근해, 제한 접두어 레이블 추가를 시도한다.

controlplane:~$ ssh node01
Last login: Mon Feb 10 22:06:42 2025 from 10.244.0.131

node01:~$ export KUBECONFIG=/etc/kubernetes/kubelet.conf
node01:~$ k get node
Error from server (Forbidden): nodes is forbidden: User "system:node:node01" cannot list resource "nodes" in API group "" at the cluster scope: node 'node01' cannot read all nodes, only its own Node object

레이블 추가 시도:

node01:~$ k label node node01 node-restriction.kubernetes.io/one=123
node/node01 labeled

레이블이 실제로 적용되었는지 확인:

node01:~$ k get node node01 --show-labels | tr ',' '\n' | grep node-restriction.kubernetes.io/one
node-restriction.kubernetes.io/one=123

위와 같이 Kubelet 자격으로 제한 접두어 레이블이 성공적으로 추가되었다면, 현재 NodeRestriction이 적용되지 않았음을 확인한 것이다.

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}