Kubectl CRD 삭제 편집하기

경고: 로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다. 로그인하거나 계정을 생성하면 편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.

편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.

최신판 당신의 편집
1번째 줄: 1번째 줄:
==개요==
==개요==
{{소문자}}
;kubectl CRD 삭제
;kubectl CRD 삭제
;kubectl CRD 재귀 삭제
;kubectl CRD 재귀 삭제
;kubectl CRD 캐스케이드 삭제
;kubectl CRD 캐스케이드 삭제


==방법 1: 수동 ==
* 삭제대상 CRD 목록 조회
* 삭제대상 CRD 목록 조회
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
$ kubectl get crds -oname | grep cluster.x-k8s.io | sed 's|.*/||'
$ kubectl get crd | grep cluster.x-k8s.io
addonproviders.operator.cluster.x-k8s.io
addonproviders.operator.cluster.x-k8s.io                     2024-02-22T16:35:14Z
bootstrapproviders.operator.cluster.x-k8s.io
bootstrapproviders.operator.cluster.x-k8s.io                 2024-02-22T16:35:14Z
clusterclasses.cluster.x-k8s.io
clusterclasses.cluster.x-k8s.io                             2024-02-22T16:35:43Z
...
...
machinepools.cluster.x-k8s.io
machinepools.cluster.x-k8s.io                               2024-02-22T16:35:43Z
machines.cluster.x-k8s.io
machines.cluster.x-k8s.io                                   2024-02-22T16:35:43Z
machinesets.cluster.x-k8s.io
machinesets.cluster.x-k8s.io                                 2024-02-22T16:35:43Z
</syntaxhighlight>
* 삭제대상 CRD 인스턴스 목록 조회
<syntaxhighlight lang='console'>
$ kubectl get crds -oname | grep cluster.x-k8s.io | sed 's|^.*/||' | xargs -n1 kubectl get -A -o custom-columns=":metadata.namespace,:kind,:metadata.name" | xargs -n3 echo
capi-kubeadm-bootstrap-system BootstrapProvider kubeadm
capi-kubeadm-control-plane-system ControlPlaneProvider kubeadm
capi-system CoreProvider cluster-api
docker-infrastructure-system InfrastructureProvider docker
</syntaxhighlight>
 
==방법 1: 인스턴스 자동 삭제==
* CRD 삭제 명령어 생성
<syntaxhighlight lang='console'>
$ kubectl get crds -oname | grep cluster.x-k8s.io | sed 's|.*/||' | xargs -n1 echo kubectl delete crd --cascade=foreground
kubectl delete crd --cascade=foreground addonproviders.operator.cluster.x-k8s.io
kubectl delete crd --cascade=foreground bootstrapproviders.operator.cluster.x-k8s.io
kubectl delete crd --cascade=foreground clusterclasses.cluster.x-k8s.io
...
kubectl delete crd --cascade=foreground machinepools.cluster.x-k8s.io
kubectl delete crd --cascade=foreground machines.cluster.x-k8s.io
kubectl delete crd --cascade=foreground machinesets.cluster.x-k8s.io
</syntaxhighlight>
* CRD 삭제 명령어 실행
<syntaxhighlight lang='console'>
$ kubectl delete crd --cascade=foreground addonproviders.operator.cluster.x-k8s.io
customresourcedefinition.apiextensions.k8s.io "addonproviders.operator.cluster.x-k8s.io" deleted
...
$ kubectl delete crd --cascade=foreground machinepools.cluster.x-k8s.io
customresourcedefinition.apiextensions.k8s.io "machinepools.cluster.x-k8s.io" deleted
$ kubectl delete crd --cascade=foreground machinesets.cluster.x-k8s.io
customresourcedefinition.apiextensions.k8s.io "machinesets.cluster.x-k8s.io" deleted
</syntaxhighlight>
 
==방법 2: 인스턴스 수동 삭제==
* CRD 인스턴스 삭제 명령어 생성
<syntaxhighlight lang='console'>
$ kubectl get crds -oname | grep cluster.x-k8s.io | sed 's|^.*/||' | xargs -n1 kubectl get -A -o custom-columns=":metadata.namespace,:kind,:metadata.name" | xargs -n3 echo kubectl delete -n
kubectl delete -n capi-kubeadm-bootstrap-system BootstrapProvider kubeadm
kubectl delete -n capi-kubeadm-control-plane-system ControlPlaneProvider kubeadm
kubectl delete -n capi-system CoreProvider cluster-api
kubectl delete -n docker-infrastructure-system InfrastructureProvider docker
</syntaxhighlight>
* CRD 인스턴스 삭제 명령어 실행
<syntaxhighlight lang='console'>
$ kubectl delete -n capi-kubeadm-bootstrap-system BootstrapProvider kubeadm
bootstrapprovider.operator.cluster.x-k8s.io "kubeadm" deleted
$ kubectl delete -n capi-kubeadm-control-plane-system ControlPlaneProvider kubeadm
controlplaneprovider.operator.cluster.x-k8s.io "kubeadm" deleted
$ kubectl delete -n capi-system CoreProvider cluster-api
coreprovider.operator.cluster.x-k8s.io "cluster-api" deleted
$ kubectl delete -n docker-infrastructure-system InfrastructureProvider docker
infrastructureprovider.operator.cluster.x-k8s.io "docker" deleted
</syntaxhighlight>
* CRD 삭제 명령어 생성
<syntaxhighlight lang='console'>
$ kubectl get crds -oname | grep cluster.x-k8s.io | sed 's|.*/||' | xargs -n1 echo kubectl delete crd
kubectl delete crd addonproviders.operator.cluster.x-k8s.io
kubectl delete crd bootstrapproviders.operator.cluster.x-k8s.io
kubectl delete crd clusterclasses.cluster.x-k8s.io
...
kubectl delete crd machinepools.cluster.x-k8s.io
kubectl delete crd machines.cluster.x-k8s.io
kubectl delete crd machinesets.cluster.x-k8s.io
</syntaxhighlight>
* CRD 삭제 명령어 실행
<syntaxhighlight lang='console'>
$ kubectl delete crd addonproviders.operator.cluster.x-k8s.io
customresourcedefinition.apiextensions.k8s.io "addonproviders.operator.cluster.x-k8s.io" deleted
...
$ kubectl delete crd machinepools.cluster.x-k8s.io
customresourcedefinition.apiextensions.k8s.io "machinepools.cluster.x-k8s.io" deleted
$ kubectl delete crd machinesets.cluster.x-k8s.io
customresourcedefinition.apiextensions.k8s.io "machinesets.cluster.x-k8s.io" deleted
</syntaxhighlight>
</syntaxhighlight>


제타위키에서의 모든 기여는 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0 라이선스로 배포된다는 점을 유의해 주세요(자세한 내용에 대해서는 제타위키:저작권 문서를 읽어주세요). 만약 여기에 동의하지 않는다면 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다. 저작권이 있는 내용을 허가 없이 저장하지 마세요!

취소 편집 도움말 (새 창에서 열림)

이 문서에서 사용한 틀: