calicoctl delete
calicoctl delete 명령어는 타입과 이름으로, 또는 파일·디렉터리·표준 입력에서 지정한 Calico 리소스를 삭제해요. 존재하지 않는 리소스를 삭제하려고 하면 기본적으로 오류가 되며, --skip-not-exists 플래그를 쓰면 건너뜁니다. 이 문서에서는 도움말, 예제, 옵션을 소개해요.
출처: 문서
본문
이 문서는 calicoctl delete 명령어를 설명합니다.
calicoctl 명령어 전체 목록은 calicoctl 커맨드라인 인터페이스 사용자 참조를 읽어보세요.
참고: 리소스 타입별로 사용할 수 있는 작업은 Calico가 사용하는 데이터스토어(etcdv3 / Kubernetes API)에 따라 제한될 수 있어요. 각 리소스 타입의 자세한 내용은 리소스 섹션을 참고하세요.
'calicoctl delete' 명령어 도움말 표시하기
calicoctl delete --help를 실행하면 명령어의 다음 도움말 메뉴가 표시돼요.
Delete one or more Calico resources, either by type and name or from a file,
directory, or stdin. Deleting a resource that doesn't exist is treated as an
error unless --skip-not-exists is set.
Usage:
calicoctl delete [KIND [NAME...]] [flags]
Examples:
# Delete specific policies by name.
calicoctl delete networkpolicy foo bar
# Delete the resources described in a file.
calicoctl delete -f ./policy.yaml
Flags:
-c, --config string Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
-f, --filename string Filename to use to create/apply/replace/delete the resource. Use '-' for stdin.
-h, --help help for delete
-n, --namespace string Namespace of the resource.
-R, --recursive Process the filename specified in -f recursively.
--skip-empty Do not error if files contain no data.
-s, --skip-not-exists Skip over resources that do not exist.
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")
예제
-
resources.yaml의 데이터를 사용해 (타입이 섞인) 리소스 세트를 삭제합니다.
calicoctl delete -f ./resources.yaml8개의 리소스가 성공적으로 삭제되었다는 결과가 표시돼요.
Successfully deleted 8 resource(s) -
이름으로 정책 리소스를 삭제합니다. 정책 이름은 "policy1"이에요.
bin/calicoctl delete policy policy1성공했다는 결과가 표시됩니다.
Successfully deleted 1 'policy' resource(s)
옵션
-s, --skip-not-exists Skip over resources that do not exist.
-f, --filename string Filename to use to create/apply/replace/delete the resource. Use '-' for stdin.
-n, --namespace string Namespace of the resource.
일반 옵션
-c, --config string Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
함께 보기
- calicoctl 설치하기.
- 파일 형식과 스키마를 포함한 모든 유효한 리소스의 자세한 내용은 리소스(Resources)
- Calico의 셀렉터 기반 정책 모델에 대한 자세한 내용은 NetworkPolicy
더 알아보기 (Learn more)
존재하지 않는 리소스 삭제가 필요 없다면 --skip-not-exists로 스크립트를 깔끔하게 만들 수 있어요. 삭제는 되돌리기 어렵기 때문에 파일 기반 삭제 전에는 내용을 꼭 확인하세요.