calicoctl label
calicoctl label 명령에 대한 레퍼런스 문서입니다. 워크로드 엔드포인트와 노드에 레이블을 추가하거나 변경하거나 제거할 때 사용합니다. 명령 사용법과 예제, 옵션을 하나씩 살펴보겠습니다.
출처: 문서
본문
이 문서는 calicoctl label 명령을 설명합니다.
calicoctl 명령 전체 목록은 calicoctl 커맨드 라인 인터페이스 사용자 레퍼런스를 참고하세요.
참고: 특정 리소스 타입에 사용할 수 있는 액션은 Calico가 사용하는 데이터스토어(etcdv3 / Kubernetes API)에 따라 제한될 수 있습니다. 각 리소스 타입에 대한 자세한 내용은 리소스 섹션을 참고하세요.
'calicoctl label' 명령의 도움말 텍스트 보기
calicoctl label --help를 실행하면 다음과 같은 명령의 도움말 메뉴가 표시됩니다.
Add, update, or remove labels on an existing Calico resource. Set a label with
key=value (add --overwrite to replace an existing value), or remove one by
passing the key with --remove.
Usage:
calicoctl label KIND NAME [key=value | key] [flags]
Examples:
# Add a label to a node.
calicoctl label nodes node1 cluster=frontend
# Overwrite an existing label value.
calicoctl label nodes node1 cluster=backend --overwrite
# Remove a label.
calicoctl label nodes node1 cluster --remove
Flags:
-c, --config string Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
-h, --help help for label
-n, --namespace string Namespace of the resource.
--overwrite Overwrite the value when the key is already present in labels.
--remove Remove the specified key from labels.
Global Flags:
--allow-version-mismatch Allow client and cluster versions mismatch
--context string The name of the kubeconfig context to use
-l, --log-level string Set the log level (panic, fatal, error, warn, info, debug) (default "panic")
예제
-
노드에 레이블을 붙입니다.
calicoctl label nodes node1 cluster=backend결과는 레이블이 성공적으로 적용되었음을 나타냅니다.
Successfully set label cluster on nodes node1 -
노드에 레이블을 붙이고
cluster키의 원래 값을 덮어씁니다.calicoctl label nodes node1 cluster=frontend --overwrite결과는 레이블이 성공적으로 덮어써졌음을 나타냅니다.
Successfully updated label cluster on nodes node1 -
노드에서
cluster키를 가진 레이블을 제거합니다.calicoctl label nodes node1 cluster --remove결과는 레이블이 성공적으로 제거되었음을 나타냅니다.
Successfully removed label cluster from nodes node1.
옵션
-n, --namespace string Namespace of the resource.
--overwrite Overwrite the value when the key is already present in labels.
--remove Remove the specified key from labels.
일반 옵션
-c, --config string Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
더 보기
- calicoctl 설치하기
- 리소스 — 파일 형식과 스키마를 포함한 모든 유효한 리소스의 상세 내용
더 알아보기 (Learn more)
레이블은 BGPPeer nodeSelector 같은 셀렉터 기반 구성의 기본 재료입니다. --overwrite와 --remove 플래그만 기억해도 레이블 관리 대부분을 처리할 수 있습니다.