v1.8.4๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ ์ญ์ ๋ ๋ค์ ์คํ์ด์ค๊ฐ "์ข ๋ฃ ์ค"์ํ๋ก ์์ํ ์ ์ง๋๋ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ด๋ฏธ "kubectl delete namespace XXXX"๋ฅผ ์ํํ์ต๋๋ค.
/ sig api-machinery
@ shean-guangchang ์ด๊ฒ์ ์ฌํ ํ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
๊ถ๊ธํด์ CRD๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๊น? ์ฐ๋ฆฌ๋ ์ด์ ์ TPR์์์ด ๋ฌธ์ ์ ์ง๋ฉดํ์ต๋๋ค.
/ ์ข ๋ฅ์ ๋ฒ๊ทธ
๋ฃจํฌ ๋ฐฐํฌ์์์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
โ tmp git:(master) โ kubectl delete namespace rook
Error from server (Conflict): Operation cannot be fulfilled on namespaces "rook": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
โ tmp git:(master) โ
๋๋ ๊ทธ๊ฒ์ด ๊ทธ๋ค์ CRD์ ๊ด๋ จ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค. API ์๋ฒ ๋ก๊ทธ์์ ์ด๊ฒ์ ๋ณผ ์ ์์ต๋๋ค.
E0314 07:28:18.284942 1 crd_finalizer.go:275] clusters.rook.io failed with: timed out waiting for the condition
E0314 07:28:18.287629 1 crd_finalizer.go:275] clusters.rook.io failed with: Operation cannot be fulfilled on customresourcedefinitions.apiextensions.k8s.io "clusters.rook.io": the object has been modified; please apply your changes to the latest version and try again
์ง๊ธ ๋ค๋ฅธ ๋ค์ ์คํ์ด์ค์ ๋ฃจํฌ๋ฅผ ๋ฐฐํฌํ์ง๋ง ํด๋ฌ์คํฐ CRD๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.
โ tmp git:(master) โ cat rook/cluster.yaml
apiVersion: rook.io/v1alpha1
kind: Cluster
metadata:
name: rook
namespace: rook-cluster
spec:
dataDirHostPath: /var/lib/rook-cluster-store
โ tmp git:(master) โ kubectl create -f rook/
Error from server (MethodNotAllowed): error when creating "rook/cluster.yaml": the server does not allow this method on the requested resource (post clusters.rook.io)
CRD๊ฐ ์ ๋ฆฌ๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค.
โ tmp git:(master) โ kubectl get customresourcedefinitions clusters.rook.io -o yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: 2018-02-28T06:27:45Z
deletionGracePeriodSeconds: 0
deletionTimestamp: 2018-03-14T07:36:10Z
finalizers:
- customresourcecleanup.apiextensions.k8s.io
generation: 1
name: clusters.rook.io
resourceVersion: "9581429"
selfLink: /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/clusters.rook.io
uid: 7cd16376-1c50-11e8-b33e-aeba0276a0ce
spec:
group: rook.io
names:
kind: Cluster
listKind: ClusterList
plural: clusters
singular: cluster
scope: Namespaced
version: v1alpha1
status:
acceptedNames:
kind: Cluster
listKind: ClusterList
plural: clusters
singular: cluster
conditions:
- lastTransitionTime: 2018-02-28T06:27:45Z
message: no conflicts found
reason: NoConflicts
status: "True"
type: NamesAccepted
- lastTransitionTime: 2018-02-28T06:27:45Z
message: the initial names have been accepted
reason: InitialNamesAccepted
status: "True"
type: Established
- lastTransitionTime: 2018-03-14T07:18:18Z
message: CustomResource deletion is in progress
reason: InstanceDeletionInProgress
status: "True"
type: Terminating
โ tmp git:(master) โ
๋น์ทํ ์ํ์ ํต๋ถ์ด ๋ค์ ์คํ์ด์ค๊ฐ ์์ต๋๋ค.
โ tmp git:(master) โ kubectl delete namespace fission
Error from server (Conflict): Operation cannot be fulfilled on namespaces "fission": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
โ tmp git:(master) โ kubectl get pods -n fission
NAME READY STATUS RESTARTS AGE
storagesvc-7c5f67d6bd-72jcf 0/1 Terminating 0 8d
โ tmp git:(master) โ kubectl delete pod/storagesvc-7c5f67d6bd-72jcf --force --grace-period=0
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
Error from server (NotFound): pods "storagesvc-7c5f67d6bd-72jcf" not found
โ tmp git:(master) โ kubectl describe pod -n fission storagesvc-7c5f67d6bd-72jcf
Name: storagesvc-7c5f67d6bd-72jcf
Namespace: fission
Node: 10.13.37.5/10.13.37.5
Start Time: Tue, 06 Mar 2018 07:03:06 +0000
Labels: pod-template-hash=3719238268
svc=storagesvc
Annotations: <none>
Status: Terminating (expires Wed, 14 Mar 2018 06:41:32 +0000)
Termination Grace Period: 30s
IP: 10.244.2.240
Controlled By: ReplicaSet/storagesvc-7c5f67d6bd
Containers:
storagesvc:
Container ID: docker://3a1350f6e4871b1ced5c0e890e37087fc72ed2bc8410d60f9e9c26d06a40c457
Image: fission/fission-bundle:0.4.1
Image ID: docker-pullable://fission/fission-bundle<strong i="6">@sha256</strong>:235cbcf2a98627cac9b0d0aae6e4ea4aac7b6e6a59d3d77aaaf812eacf9ef253
Port: <none>
Command:
/fission-bundle
Args:
--storageServicePort
8000
--filePath
/fission
State: Terminated
Exit Code: 0
Started: Mon, 01 Jan 0001 00:00:00 +0000
Finished: Mon, 01 Jan 0001 00:00:00 +0000
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/fission from fission-storage (rw)
/var/run/secrets/kubernetes.io/serviceaccount from fission-svc-token-zmsxx (ro)
Conditions:
Type Status
Initialized True
Ready False
PodScheduled True
Volumes:
fission-storage:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: fission-storage-pvc
ReadOnly: false
fission-svc-token-zmsxx:
Type: Secret (a volume populated by a Secret)
SecretName: fission-svc-token-zmsxx
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events: <none>
โ tmp git:(master) โ
ํต๋ถ์ด์ ๋ํ CRD๋ฅผ ์ฌ์ฉํ์ง๋ง ์ ํ ๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค.
@ shean-guangchang-์ ๋ ๊ฐ์ ๋ฌธ์ ๊ฐ์์์ต๋๋ค. ๋ค์ ์คํ์ด์ค ์๋์ ๋ชจ๋ ํญ๋ชฉ์ ์๋์ผ๋ก ์ญ์ ํ๊ณ "helm"์์ ๋ชจ๋ ํญ๋ชฉ์ ์ญ์ ๋ฐ ์ ๊ฑฐํ๊ณ ๋ง์คํฐ ๋ ธ๋๋ฅผ ํ๋์ฉ ๋ค์ ์์ํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
๋ด๊ฐ ๋ง๋ ๊ฒ์ "๋ฐฉ์ฃผ", "๊ฒฝ์ด๊ธฐ"๋ฐ Kuberenets๊ฐ ๋ชจ๋ ํจ๊ป ์๋ํ๋ ๊ฒ๊ณผ ๊ด๋ จ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค (๋๋ ํฌ๊ตฌ๋ฅผ ์ฌ์ฉํ์ฌ ๋ถํธ ์คํธ๋ฉํ๊ณ ๋ฐฉ์ฃผ๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐฑ์ ). ๋ฐ๋ผ์ ์ด๊ฒ์ ๋ค๋ฅธ ์ชฝ์์๋ Kuberenets ๋ฌธ์ ๊ฐ ์๋ ์ ์์ต๋๋ค. ์, ๊ด๋ จ ๋ก๊ทธ๊ฐ ์๊ธฐ ๋๋ฌธ์ ๋ฌธ์ ํด๊ฒฐ์ด ๊ฑฐ์ ๋ถ๊ฐ๋ฅํ์ต๋๋ค.
๋ฃจํฌ ์ธ ๊ฒฝ์ฐ https://github.com/rook/rook/issues/1488#issuecomment -365058080์ ์ดํด๋ณด์ธ์.
๋๋ ๊ทธ๊ฒ์ด ์๋ฏธ๊ฐ ์๋ค๊ณ ์๊ฐํ์ง๋ง ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ๋ถ๊ฐ๋ฅํ ์ํ๋ก ๋ง๋๋ ๊ฒ์ด ๊ฐ๋ฅํ๋ค๋ ๊ฒ์ ๋ฒ๊ทธ๊ฐ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
@barakAtSoluto ์ ๋น์ทํ ํ๊ฒฝ (Ark & Helm)์ด ์์ผ๋ฉฐ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ง์คํฐ๋ฅผ ์ ๊ฑฐํ๊ณ ๋ค์ ์์ํด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค. ์ฌ์ ํ ์ข ๋ฃ ์ค์ ๋๋ค.
๋ฌธ์ ๋ฅผ ์ฌํํ๋ ค๊ณ ํ ๋๋ ๋ง์ฐฌ๊ฐ์ง์์ต๋๋ค. ๊ฒฐ๊ตญ ์ ํด๋ฌ์คํฐ๋ฅผ ๋ง๋ค์ด์ผํ์ต๋๋ค ....
์ ์ธ-๊ธฐ๋ณธ, kube-system / public ๋ฐ ๋ชจ๋ ark ๊ด๋ จ ๋ค์ ์คํ์ด์ค๊ฐ ๋ฐฑ์
๋ฐ ๋ณต์์์ ๋ฐ์ํ์ง ์๋๋ก ๋ฐฉ์งํฉ๋๋ค.
1.8.4์์ 1.9.6์ผ๋ก ์ ๊ทธ๋ ์ด๋ ๋ ํด๋ฌ์คํฐ์์๋์ด ๋ฌธ์ ๋ฅผ๋ณด๊ณ ์์ต๋๋ค. ์ด๋ค ๋ก๊ทธ๋ฅผ๋ณด์์ผํ ์ง์กฐ์ฐจ ๋ชจ๋ฆ ๋๋ค.
1.10.1์ ๋ํ ๋์ผํ ๋ฌธ์ :(
1.9.6์์ ๋์ผํ ๋ฌธ์
ํธ์ง : ์ผ๋ถ ํฌ๋๊ฐ ์ค๋จ๋์ด ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ์ ์์ต๋๋ค. --grace-period = 0 --force๋ก ๋ชจ๋ ์ญ์ ํ๊ณ ๋ช ๋ถ ํ์ ๋ค์ ์คํ์ด์ค๋ ์ญ์ ๋์์ต๋๋ค.
์ผ,
๋๋ ์ด๊ฒ์ ๋ฐ๋ณตํด์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ ๋๋ถ๋ถ์ ๊ฒฝ์ฐ ์ข ๋ฃ ์์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๋ค์ ์คํ์ด์ค๊ฐ ๋ฉ์ถ ๊ฒฝ์ฐ kubectl get namespace XXX -o yaml
์๋ํ๊ณ ์ข
๋ฃ์๊ฐ ์๋์ง ํ์ธํ์ญ์์ค. ๊ทธ๋ ๋ค๋ฉด ๋ค์ ์คํ์ด์ค๋ฅผ ํธ์งํ๊ณ ์ข
๋ฃ์๋ฅผ ์ ๊ฑฐ (๋น ๋ฐฐ์ด ์ ๋ฌ)ํ๋ฉด ๋ค์ ์คํ์ด์ค๊ฐ ์ญ์ ๋ฉ๋๋ค.
@xetys ๋ ์์ ํฉ๋๊น? ์ ๊ฒฝ์ฐ์๋ "kubernetes"๋ผ๋ ์ด๋ฆ์ ์ข ๋ฃ์๊ฐ ํ๋๋ฟ์ ๋๋ค.
์ด์ํฉ๋๋ค. ๊ทธ๋ฐ ์ข ๋ฃ์๋ฅผ ๋ณธ ์ ์ด ์์ต๋๋ค. ๋๋ ๋ด ๊ฒฝํ์ ๋ฐํ์ผ๋ก ๋งํ ์ ์์ต๋๋ค. ํ๋ก๋์ ํด๋ฌ์คํฐ์์ ์ฌ๋ฌ ๋ฒ ์ํํ์ง๋ง ์ฌ์ ํ ์ด์ ์์ต๋๋ค.
1.10.5์์ ๋์ผํ ๋ฌธ์ . ์ด ๋ฌธ์ ์ ๋ํ ๋ชจ๋ ์กฐ์ธ์ ๊ฒฐ๊ณผ์์ด ์๋ํ์ต๋๋ค. ํฌ๋๋ฅผ ์ ๊ฑฐ ํ ์ ์์์ง๋ง ๋ค์ ์คํ์ด์ค๋ ์ฌ์ ํ ๋งค๋ฌ๋ ค ์์ต๋๋ค.
์ค์ ๋ก ns๋ ์ ์ ํ ์ญ์ ๋์์ต๋๋ค.
์ด ๋์์ ์์ธ์ ์ดํดํ๋ ๊ฒ์ด ์ข์ ๊ฒ์ ๋๋ค. ๋ด๊ฐ ๊ฐ์ง ์ ์ผํ ์ข ๋ฃ์๋ kubernetes์ ๋๋ค. ๋ํ ๋์ ์นํ ์ด ์๋๋ฐ ๊ด๋ จ ๋ ์ ์์ต๋๊น?
@xetys ๊ธ์, ๋ง์นจ๋ด ๋๋ ๊ทธ ๋ค์ ์คํ์ด์ค ๋ด๋ถ์ ๋ณต์ ๋ณธ์ ๋ํ ํธ๋ฆญ์ ์ฌ์ฉํ์ต๋๋ค. ๊ทธ๋ค์ ์๋ง๋ ๋ ์ด์ ์กด์ฌํ์ง ์๋ ์ปค์คํ ํ์ด๋ ๋ผ์ด์ ๋ฅผ ๊ฐ์ง๊ณ ์์๊ธฐ ๋๋ฌธ์ ์ญ์ ํ ์ ์์์ต๋๋ค. ํด๋น ์ข ๋ฃ ์์ ๋ํ ์ฐธ์กฐ๋ฅผ ์ ๊ฑฐํ์ ๋ ๊ทธ๊ฒ๋ค์ด ์ฌ๋ผ์ง๊ณ ๋ค์ ์คํ์ด์ค๋ ์ฌ๋ผ์ก์ต๋๋ค. ๊ฐ์ฌ! :)
EKS 1.10.3 ํด๋ฌ์คํฐ์์ ๋์ผํ ๋ฌธ์ :
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-28T20:13:43Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
๋ฒ ์ด ๋ฉํ ํด๋ฌ์คํฐ์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T20:17:28Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:43:26Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
๋ด ๋ค์ ์คํ์ด์ค๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
apiVersion: v1
kind: Namespace
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"name":"creneaux-app","namespace":""}}
name: creneaux-app
spec:
finalizers:
- kubernetes
์ค์ ๋ก์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ ๋ ๋ฒ์งธ ๋ค์ ์คํ์ด์ค์ ๋๋ค.
๋ค์ ์คํ์ด์ค์์๋ ๋ชจ๋ ํญ๋ชฉ์ ์ค์ ๋ชฉ๋ก์ ์ป์ผ๋ ค๋ฉด ๋ค์์ ์๋ํ์ญ์์ค. https://github.com/kubernetes/kubectl/issues/151#issuecomment -402003022
๊ทธ๋ฐ ๋ค์ ๊ฐ ๊ฐ์ฒด์ ๋ํด kubectl delete
๋๋ kubectl edit
๋ฅผ ์ํํ์ฌ ์ข
๋ฃ์๋ฅผ ์ ๊ฑฐํฉ๋๋ค.
์ด๋์ ๋ผ์ด์ ๋ฅผ ์ ๊ฑฐํ๋ฉด ํธ๋ฆญ์ด ์๊ฒผ์ต๋๋ค ...
kubectl edit namespace annoying-namespace-to-delete
ํ๊ณ ์ข
๋ฃ์๋ฅผ ์ ๊ฑฐํ๋ฉด kubectl get -o yaml
ํ์ธํ๋ฉด ๋ค์ ์ถ๊ฐ๋ฉ๋๋ค.
๋ํ @adampl ์ ์ ์ํ ๊ฒ์ ์๋ ํ ๋ ์ถ๋ ฅ์ด ํ์๋์ง ์์ต๋๋ค ( --ignore-not-found
์ ๊ฑฐํ๋ฉด ๋ชจ๋ ์ ํ์ ๋ค์ ์คํ์ด์ค์ ๋ฆฌ์์ค๊ฐ ์์์ ํ์ธ ํจ).
@ManifoldFR , ๋๋ ๋น์ ๊ณผ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ json ํ์ผ๋ก API ํธ์ถ์ ๋ง๋ค์ด ์๋ํ๋๋ก ๊ด๋ฆฌํ์ต๋๋ค.
kubectl get namespace annoying-namespace-to-delete -o json > tmp.json
๊ทธ๋ฐ ๋ค์ tmp.json์ ํธ์งํ๊ณ "kubernetes"
์ ๊ฑฐํ์ญ์์ค.
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://kubernetes-cluster-ip/api/v1/namespaces/annoying-namespace-to-delete/finalize
๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํด์ผํฉ๋๋ค.
@slassh ์๋ํ์ต๋๋ค! API ํธ์ถ์ ๋ํด ์๊ฐ ํ์ด์ผํ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค! ์ฐ๋ฆฌ๋ ์์ํ ๋น์ ์ ์ฐฌ์์ ๋ ธ๋ ํ ๊ฒ์ ๋๋ค
v1.11.1์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋์ฟ ์ํค์ ๋ชฉ์ฅ์ฃผ / ์กฐํ ๋ฐฐํฌ๊ฐ ๋งํ์ต๋๋ค. ๋จผ์ @siXor๊ฐ ์ ์ํ๋๋ก ํฌ๋๋ฅผ ๊ฐ์ ๋ก ์ญ์ ํ ๋ค์ @slassh ์กฐ์ธ์ ๋ฐ๋ผ์ผ
@slassh kubernetes-cluster-ip๋ฅผ ๋ณด๋ ๋ฐฉ๋ฒ์ ๋ฌด์์ ๋๊น? kubernetes ํด๋ฌ์คํฐ ๊ต์ฒด๋ฅผ ๋ฐฐํฌ ํ ๋ ธ๋ IP ์ค ํ๋๋ฅผ ์ฌ์ฉํ๊ณ 404๋ฅผ๋ณด๊ณ ํฉ๋๋ค.
์๋
ํ์ธ์ @jiuchongxiao , kubernetes-cluster-ip์ ๋
ธ๋ ๋ง์คํฐ IP ์ค ํ๋๋ฅผ ์๋ฏธํ์ต๋๋ค.
ํท๊ฐ ๋ฆฌ๋ฉด ์ฃ์กํฉ๋๋ค!
๋จผ์ 'kubectl ํ๋ก์'๋ฅผ ์์ํ๋ฉด curl์ http://127.0.0.1 : 8001 / api / v1 / namespaces / annoying-namespace-to-delete / finalize๋ก ์ง์ ํ ์ ์์ต๋๋ค. ๊ทธ๋ ๊ฒ ํ ๋๊น์ง ์ธ์ฆ์๋ฐ์ ์ ์์์ต๋๋ค.
์ข์ ํ @ 2stacks. https
๋ฅผ http
๋ฉ๋๋ค.
1.11.2์์ ์ฌ์ ํ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ฌํ์ ๋ํ ๋ ๋ง์ ์ปจํ
์คํธ๋ฅผ ์ ๊ณตํ๊ธฐ ์ํด CRD์์๋ง ์ด๊ฒ์ ๋ณด์์ต๋๋ค. CRD ๊ฐ์ฒด๋ฅผ ์ญ์ ํ๋ฉด ์์ ํ ๊ฐ์ฒด๊ฐ ์ญ์ ๋์ง ์์ ์ด์ํ ์ํ๊ฐ๋์์ต๋๋ค. ๋์น ์ฑ์ง ๋ชปํ๊ธฐ ๋๋ฌธ์ ๋ค์ ์คํ์ด์ค์ ๋ํ ์ญ์ ๋ฅผ ๋ฐํํ์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ kubectl delete all --all -n my-namespace
๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์คํ์ด์ค์ ๋ชจ๋ ๊ฐ์ฒด๋ฅผ ์ญ์ ํ์ต๋๋ค. ๊ทธ ์์ ์์ ๋ค์ ์คํ์ด์ค ์ญ์ ๊ฐ ์ค๋จ๋์์ต๋๋ค. ์ด๊ฒ์ด ์ด๋ค ์ ์ผ๋ก๋ ๋์์ด๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
๋ก๊ทธ๋ฅผ ์ดํด๋ณด๋ฉด์ด ํน์ ๋ฌธ์ ๊ฐ ์ปจํธ๋กค๋ฌ ๊ด๋ฆฌ์๊ฐ ๋น์ ์์ ์ธ ๊ฒ๊ณผ ๊ด๋ จ์ด ์๋ค๋ ๊ฒ์ ์์์ต๋๋ค. ์ ๊ฒฝ์ฐ์๋ ๋ฒ๊ทธ๊ฐ ์๋ ์์ต๋๋ค. ์ปจํธ๋กค๋ฌ ๊ด๋ฆฌ์๊ฐ ๋ค์ ์ฌ๋ผ ๊ฐ์ ๋ ๋ชจ๋ ๊ฒ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฆฌ๋์์ต๋๋ค.
@slassh ์๋ฒฝํ ์๋ฃจ์ ! ๋๋จํ ๊ฐ์ฌํฉ๋๋ค ๏ผ๏ผ๏ผ๏ผ
1.10.x์์๋์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. @slassh ์ ์๊ฒฌ์ ์ค์ ๋ฌธ์ ๋ฅผ ์จ๊ธฐ๋ ํด๊ฒฐ ๋ฐฉ๋ฒ์
๋๋ค. ๋ค์ ์คํ์ด์ค๊ฐ Terminating
์์ ๋ฉ์ถ ์ด์ ๋ ๋ฌด์์
๋๊น?
์ฐ๋ฆฌ์ ๊ฒฝ์ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ๋ ์ด์ ๋ฅผ ๋ฐ๊ฒฌํ์ต๋๋ค (@palmerabollo).
๋ค์ ์คํ์ด์ค์ ์ข
๋ฃ ์ kubernetes
๊ฒฝ์ฐ ์ด๋ API ์๋ฒ์ ๋ด๋ถ ๋ฌธ์ ๋ฅผ ์๋ฏธํฉ๋๋ค.
kubectl api-resources
์คํํฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ๋ฐํ๋๋ฉด ์ฌ์ฉ์ ์ง์ API์ ์ฐ๊ฒฐํ ์ ์์์ ์๋ฏธํฉ๋๋ค.
error: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request
์ํ ์กฐ๊ฑด์ ํ์ธํ๋ ค๋ฉด kubectl get apiservices v1beta1.metrics.k8s.io -o yaml
์คํํ์ญ์์ค.
status:
conditions:
- lastTransitionTime: 2018-10-15T08:14:15Z
message: endpoints for service/metrics-server in "kube-system" have no addresses
reason: MissingEndpoints
status: "False"
type: Available
์์ ์ค๋ฅ๋ metrics-server์ ์ํฅ์ ๋ฏธ์น๋ crashloopbackoff๋ก ์ธํด ๋ฐ์ํด์ผํฉ๋๋ค. Kubernetes์ ๋ฑ๋ก ๋ ๋ค๋ฅธ ์ฌ์ฉ์ ์ง์ API์ ๊ฒฝ์ฐ์ ์ ์ฌํฉ๋๋ค.
๋ค์ ์คํ์ด์ค ์ญ์ ์ ๊ฐ์ ํด๋ฌ์คํฐ ๋ฐํ์ ์์
์ ๋ณต์ํ๋ ค๋ฉด kube-system
์์ ์๋น์ค ์ํ๋ฅผ ํ์ธํ์ธ์.
v1.11.3์์์ด ๋ฌธ์ ์ ์ง๋ฉดํ์ต๋๋ค. ์ข ๋ฃ ์์๋ ๋ฌธ์ ๊ฐ์๋ ๋ค์ ์คํ์ด์ค์ ๋ํ kubernetes ๋ง ์์ต๋๋ค.
spec:
finalizers:
- kubernetes
@slassh ๋ฐฑ๋ง๋ช
๊ฐ์ฌํฉ๋๋ค, ๊ทํ์ ์๋ฃจ์
์ ์ ์๋ํฉ๋๋ค!
ark, tiller ๋ฐ kubed์ ํจ๊ป ํด๋ฌ์คํฐ์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ฌธ์ ๊ฐ ๋ค๋ฅธ ๋ค์ ์คํ์ด์ค์ ์ญ์ ์ ์ํฅ์ ๋ฏธ์น๋ ์ด์ ๋ ํ์คํ์ง ์์ง๋ง ์ค๋ฅ๋ฅผ ์ ๊ณตํ๋ kubed์ API ์ผ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
@javierprovecho ๋๋ ๋จ์ง ๋ฉํธ๋ฆญ ์๋ฒ๋ฅผ ๊ฐ์ง๊ณ
status:
conditions:
- lastTransitionTime: 2018-08-24T08:59:36Z
message: service/metrics-server in "kube-system" is not present
reason: ServiceNotFound
status: "False"
type: Available
์ด ์ํ์์ ํ๋ณตํ๋ ๋ฐฉ๋ฒ์ ์๊ณ ์์ต๋๊น?
ํธ์ง : ์์ ๋์ต๋๋ค ... ์ธก์ ํญ๋ชฉ / HPA์ ์๊ฒฉ์ผ๋ก ๊ด๋ จ๋ ๋ชจ๋ ํญ๋ชฉ์ ์ญ์ ํ ๋ค์ ์ ์ฒด ์ ์ด ํ๋ ์ธ์ ๋ค์ ์์ํด์ผํ์ต๋๋ค (๋ฐฑ์
ํ๊ธฐ ์ ์ ๋ชจ๋ ๋ณต์ ๋ณธ์ ์ ๊ฑฐํด์ผ ํจ). ์ฌ๊ธฐ์๋ apiservice
์ญ์ ๊ฐ ํฌํจ๋ฉ๋๋ค. v1beta1.metrics.k8s.io
์์ฒด.
๋ฟก ๋นต๋จ
$ kubectl delete apiservice v1beta1.metrics.k8s.io
์๋ํ์ง ์๋ metrics
API ์๋น์ค๋ฅผ ์ ๊ฑฐํ๋ฉด ์ปจํธ๋กค๋ฌ ๊ด๋ฆฌ์๊ฐ ์ค๋๋ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ์ ์์ต๋๋ค.
์ ์ด ํ๋ ์ธ์ ๋ค์ ์์ํ ํ์๊ฐ ์์ต๋๋ค.
@antoineco ์๋์, ํ์ํ์ต๋๋ค. apiservice๋ฅผ ์ญ์ ํ๊ณ ๊ฝค ๊ธฐ๋ค๋ ธ์ง ๋ง ์ปจํธ๋กค ํ๋ ์ธ์ ๋ค์ ์์ํ ๋๊น์ง ๋ค์ ์คํ์ด์ค๊ฐ ์ญ์ ๋์ง ์์์ต๋๋ค.
๋จผ์ ์์ ์ปคํผ๋ฅผ ๋ง์๊ณ ๊ธด์ฅ์ ํ๊ณ ์ด์ k8s ๋ง์คํฐ ๋ ธ๋๋ก ์ด๋ํ์ญ์์ค.
ํด๋ฌ์คํฐ ๋ฌธ์ ๋ฅผ ์ถ๊ฐ๋ก ๋๋ฒ๊ทธํ๊ณ ์ง๋จํ๋ ค๋ฉด 'kubectl cluster-info dump'๋ฅผ ์ฌ์ฉํ์ญ์์ค.
๋์ค์ ์ญ์ ํ๋ ค๋ฉด ID๋ฅผ ์ ์ฅํ์ญ์์ค. :)
ํ์ผ์ ๋ฃ์ด
curl -k -H "Content-Type : application / json"-X PUT --data-binary @ tmp.json http://127.0.0.1 : 8001 / api / v1 / namespaces / $ {NAMESPACE} / finalize
๊ทธ๋ฆฌ๊ณ ์ฌ๋ผ์ก์ต๋๋ค ๐
ํ์ด๋ ๋ผ์ด์ kubernetes
์ด (๊ฐ) ์ด์ ๊ฐ ์์ต๋๋ค. ์ฐ๋ฆฌ์๊ฒ๋ ์๋ชป ๊ตฌ์ฑ๋ ๋ฉํธ๋ฆญ API ์๋น์ค ์ด๋ฆ์ด์์ต๋๋ค. ์๋ง๋ ๋น์ ์ ์ ์ด ํ๋ ์ธ ๋ก๊ทธ๋ฅผ๋ณด๊ณ ๋ฐ๊ฒฌ ํ ์์๋ ๋ค๋ฅธ ๊ฒ์ผ ์๋ ์์ต๋๋ค. ๋ฒ๊ทธ ํ์ธ์์ด ์ข
๋ฃ์๋ฅผ ์ ๊ฑฐํ๋ฉด ๋ ์ด์ ์ญ์ ๋ชฉ์ ์ผ๋ก ๋ค์ ์ก์ธ์ค ํ ์์๋ ์์ฑ ๋ ํญ๋ชฉ์ ๋จ๊ฒจ ๋๋ ๊ฒ๊ณผ ๊ฐ์ ์ํ์ง ์๋ ๊ฒฐ๊ณผ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค.
์ด ๋ฌธ์ ๋ ์์ง ์งํ ์ค์ด๋ฏ๋ก :
"none"์ผ๋ก ์คํ๋๋ ๋ด minikube ํด๋ฌ์คํฐ ๋ด์์ ํธ์คํธ๊ฐ ์ต๋ ์ ์ ๋ชจ๋์์ ๊นจ์ด ๋ ํ ๋ฐ์ํ์ต๋๋ค.
๋ด ๊ฐ์ :
์ ๊ฒฝ์ฐ์๋ ์ต๋ ์ ์ ๋ชจ๋๊ฐ ๋์ผํ ๋ฌธ์ ๋ฅผ ๋ฐ์ ์์ผฐ์ผ๋ฉฐ ํ์ฑํ ๋ ์ค์์ด ๊ฐ๋ฅํฉ๋๋ค.
๊ฐ์ ์ ์ฐ์ถํฉ๋๋ค.
์ํฅ์๋ฐ๋ ํด๋ฌ์คํฐ์์ ์ค์์ด ํ์ฑํ ๋ ์ ์์ต๋๊น?
๊ทธ๋ฌ๋ ์ด๊ฒ์ ๋จ์ง ์ถ์ธก์ ๋๋ค. ๋์๊ฒ ์ค์ํ ๊ฒ์ ๋ด ๋ก์ปฌ ์ค์ ์ผ๋ก์ด ๋ฒ๊ทธ์ ์ฐฉ์ํ๋ ๋ชจ๋ ์ฌ๋ : hibernate๋ kubernetes์ ์ข์ง ์์ต๋๋ค .
๋จผ์ ์์ ์ปคํผ๋ฅผ ๋ง์๊ณ ๊ธด์ฅ์ ํ๊ณ ์ด์ k8s ๋ง์คํฐ ๋ ธ๋๋ก ์ด๋ํ์ญ์์ค.
- kubectl ํด๋ฌ์คํฐ ์ ๋ณด
Kubernetes ๋ง์คํฐ๋ https : // localhost : 6443์์ ์คํ ์ค์ ๋๋ค.
KubeDNS๋ https : // localhost : 6443 / api / v1 / namespaces / kube-system / services / kube- dns : dns / proxy์์ ์คํ๋ฉ๋๋ค.ํด๋ฌ์คํฐ ๋ฌธ์ ๋ฅผ ์ถ๊ฐ๋ก ๋๋ฒ๊ทธํ๊ณ ์ง๋จํ๋ ค๋ฉด 'kubectl cluster-info dump'๋ฅผ ์ฌ์ฉํ์ญ์์ค.
- ์ด์ kube-proxy๋ฅผ ์คํํ์ญ์์ค.
kubectl ํ๋ก์ ๋ฐ
127.0.0.1:8001์ ๊ฒ์ฌ ์์๋์ค์ ์ญ์ ํ๋ ค๋ฉด ID๋ฅผ ์ ์ฅํ์ญ์์ค. :)
- ์ญ์ ํ์ง ์๊ธฐ๋ก ๊ฒฐ์ ํ ์ด๋ฆ ๊ณต๊ฐ์ ์ฐพ์ผ์ญ์์ค. :) ์ฐ๋ฆฌ์๊ฒ๋ ๊ฐ์ถ ์์คํ ์ด ๋ ๊ฒ์ ๋๋ค.
kubectl get ns
๊ฐ์ถ ์์คํ ์ข ๋ฃ 1dํ์ผ์ ๋ฃ์ด
- kubectl get namespace cattle-system -o json> tmp.json
- ํ์ผ ํธ์ง ๋ฐ ์ข ๋ฃ ์ ์ ๊ฑฐ
},
"spec": {
"์ข ๋ฃ ์": [
"์ฟ ๋ฒ ๋ฅด๋ค ํ ์ค"
]
},
ํธ์ง ํ ๋ค์๊ณผ ๊ฐ์ด ๋ณด์ผ ๊ฒ์ ๋๋ค ๐
},
"spec": {
"์ข ๋ฃ ์": [
]
},
๊ฑฐ์ ๋ค ์์ด์ ๐curl -k -H "Content-Type : application / json"-X PUT --data-binary @ tmp.json http://127.0.0.1 : 8001 / api / v1 / namespaces / $ {NAMESPACE} / finalize
๊ทธ๋ฆฌ๊ณ ์ฌ๋ผ์ก์ต๋๋ค ๐
ํฐ!!
๊ณต์ฅ
gcloud ์ธ์คํด์ค๋ฅผ ๋ณ๊ฒฝํ๋ฉด (์ : ๋
ธ๋ ์
๊ทธ๋ ์ด๋)์ด ๋ฌธ์ ๊ฐ ์ฃผ๊ธฐ์ ์ผ๋ก ๋ฐ์ํฉ๋๋ค. ์ด๋ ๊ฒํ๋ฉด gcloud instances list
์ ์ด์ ๋
ธ๋๊ฐ ์ ๋
ธ๋๋ก ๊ต์ฒด๋์ง๋ง k8s ๋ค์ ์คํ์ด์ค์ ํฌ๋๋ ์ค๋จ๋ฉ๋๋ค.
Reason: NodeLost
Message: Node <old node> which was running pod <pod> is unresponsive
๊ทธ๋ฌ๋ฉด ํฌ๋๊ฐ ์ ์์๋ ์ํ๊ฐ๋ฉ๋๋ค.
$ kubectl get po
NAME READY STATUS RESTARTS AGE
<pod> 2/2 Unknown 0 39d
์ด๋ก ์ธํด ๋ค์ ์คํ์ด์ค๊ฐ ์ข
๋ฃ๋์ง ์์ต๋๋ค. ์ด๊ฒ์ด ์ข
๋ฃ์๋ฅผ ๋ณ๊ฒฝํด์ผํ๋์ง ๋๋ UNKNOWN
์ํ์์ ํฌ๋๋ฅผ ์ฒ๋ฆฌํด์ผํ๋ ์ข
๋ฃ์ ๊ด๋ จ๋ ์ค์ ๋ฒ๊ทธ๊ฐ ์๋์ง ์ฌ๋ถ (๋๋ ์ด์ ๊ฐ์ ๊ฒฝ์ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ๊ฐ์ ์ข
๋ฃํ๋ ๋ฐฉ๋ฒ์ด ์์ด์ผํ๋ ๊ฒฝ์ฐ) ).
gcloud ์ธ์คํด์ค๋ฅผ ๋ณ๊ฒฝํ๋ฉด (์ : ๋ ธ๋ ์ ๊ทธ๋ ์ด๋)์ด ๋ฌธ์ ๊ฐ ์ฃผ๊ธฐ์ ์ผ๋ก ๋ฐ์ํฉ๋๋ค. ์ด๋ ๊ฒํ๋ฉด
gcloud instances list
์ ์ด์ ๋ ธ๋๊ฐ ์ ๋ ธ๋๋ก ๊ต์ฒด๋์ง๋ง k8s ๋ค์ ์คํ์ด์ค์ ํฌ๋๋ ์ค๋จ๋ฉ๋๋ค.Reason: NodeLost Message: Node <old node> which was running pod <pod> is unresponsive
๊ทธ๋ฌ๋ฉด ํฌ๋๊ฐ ์ ์์๋ ์ํ๊ฐ๋ฉ๋๋ค.
$ kubectl get po NAME READY STATUS RESTARTS AGE <pod> 2/2 Unknown 0 39d
์ด๋ก ์ธํด ๋ค์ ์คํ์ด์ค๊ฐ ์ข ๋ฃ๋์ง ์์ต๋๋ค. ์ด๊ฒ์ด ์ข ๋ฃ์๋ฅผ ๋ณ๊ฒฝํด์ผํ๋์ง ๋๋
UNKNOWN
์ํ์์ ํฌ๋๋ฅผ ์ฒ๋ฆฌํด์ผํ๋ ์ข ๋ฃ์ ๊ด๋ จ๋ ์ค์ ๋ฒ๊ทธ๊ฐ ์๋์ง ์ฌ๋ถ (๋๋ ์ด์ ๊ฐ์ ๊ฒฝ์ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ๊ฐ์ ์ข ๋ฃํ๋ ๋ฐฉ๋ฒ์ด ์์ด์ผํ๋ ๊ฒฝ์ฐ) ).
๋ฉ์ง๋ค, ๊ฐ์ ๋ฌธ์ ๊ฐ ์๋์ผ
๋
ธ๋๋ฅผ ์ ์ง ๊ด๋ฆฌ ๋ชจ๋๋ก ์ ํ ํ ๋ค์ ์ ์ง ๊ด๋ฆฌ ๋ชจ๋๊ฐ๋๋ฉด ๋ชจ๋ ํฌ๋๊ฐ ๋น์์ง๊ณ ์ญ์ / ์
๊ทธ๋ ์ด๋ ํ ์ ์์ต๋๋ค.
๋ณด์ธ์ ๏ผ https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/ ,
๋ฆฌ์์ค๋ฅผ ํธ์งํ๊ณ metadata.finalizers๋ฅผ ์ญ์ ํ๊ณ ์ฌ์ฉํ์ง ์๋ crd๋ฅผ ์ญ์ ํฉ๋๋ค. ๊ฐ์ ๋ก ์ญ์ ํ ์ ์์ต๋๋ค.
๊ทธ๋ฌ๋ kubernetes
์๋ ์ ํํ ๋ฌด์์ํฉ๋๊น? ์ด ํดํน์ผ๋ก ๋ฆฌ์์ค๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฆฌ๋์ง ์์ ์ํ์ด ์์ต๋๊น?
๋ฃจํฌ๊ฐ ์ข ๋ฃํ๋ ๋ฐ ๋์์ด๋์์ต๋๋ค https://github.com/rook/rook/blob/master/Documentation/ceph-teardown.md
curl -k -H "Content-Type : application / json"-X PUT --data-binary @ tmp.json https : // kubernetes-cluster-ip / api / v1 / namespaces / annoying-namespace-to-delete / ๋ง๋ฌด๋ฆฌํ๋ค
์๋ฒ ์ค๋ฅ (NotFound) : "์ญ์ ํ ์ฑ๊ฐ์ ๋ค์ ์คํ์ด์ค"๋ค์ ์คํ์ด์ค๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
๋จผ์ ์์ ์ปคํผ๋ฅผ ๋ง์๊ณ ๊ธด์ฅ์ ํ๊ณ ์ด์ k8s ๋ง์คํฐ ๋ ธ๋๋ก ์ด๋ํ์ญ์์ค.
- kubectl ํด๋ฌ์คํฐ ์ ๋ณด
Kubernetes ๋ง์คํฐ๋ https : // localhost : 6443์์ ์คํ ์ค์ ๋๋ค.
KubeDNS๋ https : // localhost : 6443 / api / v1 / namespaces / kube-system / services / kube- dns : dns / proxy์์ ์คํ๋ฉ๋๋ค.ํด๋ฌ์คํฐ ๋ฌธ์ ๋ฅผ ์ถ๊ฐ๋ก ๋๋ฒ๊ทธํ๊ณ ์ง๋จํ๋ ค๋ฉด 'kubectl cluster-info dump'๋ฅผ ์ฌ์ฉํ์ญ์์ค.
- ์ด์ kube-proxy๋ฅผ ์คํํ์ญ์์ค.
kubectl ํ๋ก์ ๋ฐ
127.0.0.1:8001์ ๊ฒ์ฌ ์์๋์ค์ ์ญ์ ํ๋ ค๋ฉด ID๋ฅผ ์ ์ฅํ์ญ์์ค. :)
- ์ญ์ ํ์ง ์๊ธฐ๋ก ๊ฒฐ์ ํ ์ด๋ฆ ๊ณต๊ฐ์ ์ฐพ์ผ์ญ์์ค. :) ์ฐ๋ฆฌ์๊ฒ๋ ๊ฐ์ถ ์์คํ ์ด ๋ ๊ฒ์ ๋๋ค.
kubectl get ns
๊ฐ์ถ ์์คํ ์ข ๋ฃ 1dํ์ผ์ ๋ฃ์ด
- kubectl get namespace cattle-system -o json> tmp.json
- ํ์ผ ํธ์ง ๋ฐ ์ข ๋ฃ ์ ์ ๊ฑฐ
},
"spec": {
"์ข ๋ฃ ์": [
"์ฟ ๋ฒ ๋ฅด๋ค ํ ์ค"
]
},
ํธ์ง ํ ๋ค์๊ณผ ๊ฐ์ด ๋ณด์ผ ๊ฒ์ ๋๋ค ๐
},
"spec": {
"์ข ๋ฃ ์": [
]
},
๊ฑฐ์ ๋ค ์์ด์ ๐curl -k -H "Content-Type : application / json"-X PUT --data-binary @ tmp.json http://127.0.0.1 : 8001 / api / v1 / namespaces / $ {NAMESPACE} / finalize
๊ทธ๋ฆฌ๊ณ ์ฌ๋ผ์ก์ต๋๋ค ๐
์๋ชป๋ ๊ฐ : "ํธ์ง ๋ ํ์ผ ์ ํจ์ฑ ๊ฒ์ฌ์ ์คํจํ์ต๋๋ค.": ValidationError (Namespace.spec) : io.k8s.api.core.v1.NamespaceSpec์ ๋ํ ์๋ชป๋ ์ ํ : "๋ฌธ์์ด"๊ฐ์ ธ ์ค๊ธฐ, "๋งต"ํ์
Terminating ์ค์ ๋ง์ ๋ค์ ์คํ์ด์ค๊ฐ ๋ฉ์ถ ๊ฒฝ์ฐ์ด๋ฅผ ์๋ํ ํ ์ ์์ต๋๋ค.
kubectl get ns | grep Terminating | awk '{print $1}' | gxargs -n1 -- bash -c 'kubectl get ns "$0" -o json | jq "del(.spec.finalizers[0])" > "$0.json"; curl -k -H "Content-Type: application/json" -X PUT --data-binary @"$0.json" "http://127.0.0.1:8001/api/v1/namespaces/$0/finalize" '
์ข
๋ฃ์๋ฅผ ์ ๊ฑฐํ๋ ค๋ ๋ชจ๋ ๋ค์ ์คํ์ด์ค๊ฐ ์ค์ ๋ก Terminating
.
์์ ์์
์ ์ํํ๋ ค๋ฉด kubectl proxy
์คํ ๋ฐ jq
ํ์ํฉ๋๋ค.
์ฐ๋ฆฌ์ ๊ฒฝ์ฐ ๋ฉํธ๋ฆญ API ์๋น์ค๊ฐ ๋ค์ด๋์์ผ๋ฉฐ ์์ธํ ๋ก๊น ์์์ด ์ค๋ฅ ๋ก๊ทธ๋ฅผ ๋ณผ ์ ์์ต๋๋ค.
kubectl delete ns <namespace-name> -v=7
.......
I0115 11:03:25.548299 12445 round_trippers.go:383] GET https://<api-server-url>/apis/metrics.k8s.io/v1beta1?timeout=32s
I0115 11:03:25.548317 12445 round_trippers.go:390] Request Headers:
I0115 11:03:25.548323 12445 round_trippers.go:393] Accept: application/json, */*
I0115 11:03:25.548329 12445 round_trippers.go:393] User-Agent: kubectl/v1.11.3 (darwin/amd64) kubernetes/a452946
I0115 11:03:25.580116 12445 round_trippers.go:408] Response Status: 503 Service Unavailable in 31 milliseconds
๋ฉํธ๋ฆญ apiservice๋ฅผ ์์ ํ ํ ์ข
๋ฃ๊ฐ ์๋ฃ๋ฉ๋๋ค.
์ญ์ ๊ฐ ๋ฉํธ๋ฆญ apiservice์ ์์กดํ๋ ์ด์ ๊ฐ ํ์คํ์ง ์์ผ๋ฉฐ, ๋ฉํธ๋ฆญ apiservice๊ฐ ํด๋ฌ์คํฐ์ ์ค์น๋์ง ์์ ๊ฒฝ์ฐ ์ด๋ป๊ฒ ์๋ํ๋์ง ์ ์ ์์ต๋๋ค.
์ญ์ ๊ฐ ๋ฉํธ๋ฆญ apiservice์ ์์กดํ๋ ์ด์ ๋ฅผ ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
@manojbadam ๋ฉํธ๋ฆญ์ด API ์๋ฒ์ ๋ฑ๋ก๋์ด ์๊ธฐ ๋๋ฌธ์ ๋ค์ ์คํ์ด์ค ์ญ์ ๋ฅผ ์ํ ํ ๋ ํด๋น ๋ค์ ์คํ์ด์ค์ ์ฐ๊ฒฐ๋ (์กด์ฌํ๋ ๊ฒฝ์ฐ) ์ญ์ ํ (๋ค์ ์คํ์ด์ค) ๋ฆฌ์์ค์ ๋ํด ์ธ๋ถ API๋ฅผ ์ฟผ๋ฆฌํด์ผํฉ๋๋ค. ํ์ฅ ์๋ฒ๋ฅผ ์ฌ์ฉํ ์์๋ ๊ฒฝ์ฐ Kubernetes๋ ๋ชจ๋ ๊ฐ์ฒด๊ฐ ์ ๊ฑฐ๋์์์ ๋ณด์ฅ ํ ์ ์์ผ๋ฉฐ ๋ฃจํธ ๊ฐ์ฒด๊ฐ ์ ๊ฑฐ ๋์๊ธฐ ๋๋ฌธ์ ๋์ค์ ์กฐ์ ํ ์๊ตฌ ๋ฉ์ปค๋์ฆ (๋ฉ๋ชจ๋ฆฌ ๋๋ ๋์คํฌ)์ด ์์ต๋๋ค. ์ด๋ ๋ฑ๋ก ๋ ๋ชจ๋ API ํ์ฅ ์๋น์ค์์ ๋ฐ์ํฉ๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ์ง์์ ์ผ๋ก ์คํํ๋ฉด์ ์์ ์ ์คํฌ๋ฆฝํธ๋ก์ด๋ฅผ ์๋ํํ์ต๋๋ค.
https://github.com/ctron/kill-kube-ns/blob/master/kill-kube-ns
ํ๋ก์ ํธ๋ฅผ ๊ฐ์ ธ์ค๊ณ , JSON์ ์์ ํ๊ณ , "kubectl proxy"๋ฅผ ์์ํ๊ณ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์งํฉ๋๋ค.โฆ
์ ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ์๋ดํด ์ฃผ์ ๋ชจ๋ ๋ถ๋ค๊ป ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
์ด ๋ฌธ์ ๋ฅผ ์ง์์ ์ผ๋ก ์คํํ๋ฉด์ ์์ ์ ์คํฌ๋ฆฝํธ๋ก์ด๋ฅผ ์๋ํํ์ต๋๋ค.
https://github.com/ctron/kill-kube-ns/blob/master/kill-kube-ns
ํ๋ก์ ํธ๋ฅผ ๊ฐ์ ธ์ค๊ณ , JSON์ ์์ ํ๊ณ , "kubectl proxy"๋ฅผ ์์ํ๊ณ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์งํฉ๋๋ค.โฆ
์ ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ์๋ดํด ์ฃผ์ ๋ชจ๋ ๋ถ๋ค๊ป ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
๋ด ์์ ! <3
๋๋์ด ๋ฌธ์ ์ ๋ถ๋ชํ๋ค. ์ ๋ Google Kubernetes Engine์์ Terraform์ ์ฌ์ฉํ์ฌ Kubernetes ํด๋ฌ์คํฐ๋ฅผ ๊ฐ๋ํ๊ณ ํด๋ฌ์คํฐ ๋ด๋ถ์ ๋ค์ ์คํ์ด์ค์ ํฌ๋๋ฅผ ๋ง๋ญ๋๋ค. ๋ฌธ์ ๋ terraform destroy
์คํ ํ ์ ์ ์์๋์์ต๋๋ค.
์ ๊ฒฝ์ฐ์๋ Terraform์ด ํ๊ดด๋ฅผ ์คํํ๋ ์์์ ๋ฌธ์ ๊ฐ์๋ ๊ฒ์ผ๋ก ๋ฐํ์ก์ต๋๋ค. Terraform์ ๋จผ์ ๋ ธ๋ ํ์ ์ญ์ ํ ๋ค์ ๋ค์ ์คํ์ด์ค์ ํฌ๋๋ฅผ ์ญ์ ํฉ๋๋ค. ๊ทธ๋ฌ๋ (์ ์ผํ) ๋ ธ๋ ํ ์ญ์ ๋ก ์ธํด Kubernetes ํด๋ฌ์คํฐ๊ฐ ์ค๋จ๋์์ผ๋ฉฐ, ์ด๊ฒ์ด ๋ค์ ์คํ์ด์ค ์ญ์ ๊ฐ ์์ํ "์ข ๋ฃ"๋๋ ์์ธ์ด๋์์ต๋๋ค.
@FooBarWidget ๋๋ฅผ ์ํด ๊ฐ์ ๋ฌธ์ :(
์ด ๋ฌธ์ ๋ฅผ ์ง์์ ์ผ๋ก ์คํํ๋ฉด์ ์์ ์ ์คํฌ๋ฆฝํธ๋ก์ด๋ฅผ ์๋ํํ์ต๋๋ค.
https://github.com/ctron/kill-kube-ns/blob/master/kill-kube-ns
ํ๋ก์ ํธ๋ฅผ ๊ฐ์ ธ์ค๊ณ , JSON์ ์์ ํ๊ณ , "kubectl proxy"๋ฅผ ์์ํ๊ณ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์งํฉ๋๋ค.โฆ
์ ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ์๋ดํด ์ฃผ์ ๋ชจ๋ ๋ถ๋ค๊ป ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
[root@k8s-master ~]# curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://172.*****:6443/api/v1/namespaces/rook-ceph/finalize
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "namespaces "rook-ceph" is forbidden: User "system:anonymous" cannot update namespaces/finalize in the namespace "rook-ceph"",
"reason": "Forbidden",
"details": {
"name": "rook-ceph",
"kind": "namespaces"
},
"code": 403
๋ฐํ ์ฝ๋ 403์ ๋ฐ์์ต๋๋ค. ์ด๋ป๊ฒํด์ผํฉ๋๊น? (
์ด ๋ฌธ์ ๋ฅผ ์ง์์ ์ผ๋ก ์คํํ๋ฉด์ ์์ ์ ์คํฌ๋ฆฝํธ๋ก์ด๋ฅผ ์๋ํํ์ต๋๋ค.
https://github.com/ctron/kill-kube-ns/blob/master/kill-kube-ns
ํ๋ก์ ํธ๋ฅผ ๊ฐ์ ธ์ค๊ณ , JSON์ ์์ ํ๊ณ , "kubectl proxy"๋ฅผ ์์ํ๊ณ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์งํฉ๋๋ค.โฆ
์ ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ์๋ดํด ์ฃผ์ ๋ชจ๋ ๋ถ๋ค๊ป ๊ฐ์ฌ๋๋ฆฝ๋๋ค![root@k8s-master ~]# curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://172.*****:6443/api/v1/namespaces/rook-ceph/finalize { "kind": "Status", "apiVersion": "v1", "metadata": { }, "status": "Failure", "message": "namespaces "rook-ceph" is forbidden: User "system:anonymous" cannot update namespaces/finalize in the namespace "rook-ceph"", "reason": "Forbidden", "details": { "name": "rook-ceph", "kind": "namespaces" }, "code": 403
๋ฐํ ์ฝ๋ 403์ ๋ฐ์์ต๋๋ค. ์ด๋ป๊ฒํด์ผํฉ๋๊น? (
Thx god, ์ข ๋ฃ ๋ค์ ์คํ์ด์ค๊ฐ ๋ง์นจ๋ด ์ฌ๋ผ์ก์ต๋๋ค. ๋ค์ ๋ฐฉ๋ฒ์ ๋๋ฅผ ์ํด ํธ๋ฆญ์ ์ํํฉ๋๋ค.
NAMESPACE=rook-ceph
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
๋์ผํ ๋ฌธ์ ๊ฐ ์์ง๋ง ๋ฉํธ๋ฆญ ์๋น์ค๊ฐ ํ์๋์ง ์์ต๋๋ค.
๋๋ digitalocean ๋ฐ gitlab auto devops์ k8s๋ก ๋๊ณ ์์ต๋๋ค. ๋ด ๊ฐ์ ์ ์ผ๋ถ digitalocean blob ์ ์ฅ์์ด์ง๋ง ๋ถ์ํ๊ฑฐ๋ ์์ ํ๋ ๋ฐฉ๋ฒ์ ์์์ต๋๋ค.
@mingxingshi ํ ์ฌ์ค. ํธ๋ฆญ์ ์ํํ์ง ์์ ํธ์ง ๋ค์ ์คํ์ด์ค๋ฅผ ์ํํ์ต๋๋ค. ์คํฌ๋ฆฝํธ๊ฐ ํด๋์ต๋๋ค.
์์ฐ, ๋๋์ด ์ ๊ฑฐํ์ต๋๋ค. @mingxingshi ๋ช ๋ น์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
์ ์๊ฒ ํด๊ฒฐ์ฑ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
kubectl delete apiservice v1beta1.metrics.k8s.io
์ด ๊ฒฝํ์ ์ฌ๊ธฐ์ ๋จ๊ฒจ ๋์ด์ผํ๋ค๊ณ ์๊ฐํ์ต๋๋ค.
๋ค์ ๋ฆฌ์์ค๋ก terraform apply
์ (๋ฅผ) ์ํํ์ต๋๋ค.
resource "helm_release" "servicer" {
name = "servicer-api"
// n.b.: this is a local chart just for this terraform project
chart = "charts/servicer-api"
namespace = "servicer"
...
}
ํ์ง๋ง ์ ๋ helm newb์ด๊ณ servicer
๋ผ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ๋ง๋ ํ
ํ๋ฆฟ์ด์๋ ํ
ํ๋ฆฟ์ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์ด๋ก ์ธํด terraform ๋ฐ k8s๊ฐ terraform์ด ์คํจํ๋์ด ์๋ชป๋ ์ํ๊ฐ๋๊ณ k8s๋ Terminating
์ํ์์ servicer
๋ค์ ์คํ์ด์ค๋ฅผ ์๊ตฌ์ ์ผ๋ก ๋จ๊ฒจ ๋ก๋๋ค. @mingxingshi ๊ฐ ์์์
์ด ๋ฌธ์ ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ๋ง๋ ํ ํ๋ฆฟ์ ์ ๊ฑฐํ๊ณ ์ด๋ฅผ ์์ฑํ๋๋ก ๋งก๊ฒผ์ ๋ ์ ์๊ฒ ๋ฐ์ํ์ง ์์์ต๋๋ค.
๋ฌธ์ ๋ ์ ์๊ฒ ์์ ํ ๋ฐ๋ณต๋ฉ๋๋ค. ๋จผ์ prometheus-operator๋ฅผ ๋ณต์ ํฉ๋๋ค. ๊ทธ๋:
cd prometheus-operator/contrib/kube-prometheus
kubectl create -f manifests/ --validate=false
... wait ...
kubectl delete namespace monitoring
์ค๋จ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ kubectl delete -f manifests/
์ ์ฌ์ฉํ๋ฉด ์ ๋ฆฌ๊ฐ ์ฑ๊ณตํฉ๋๋ค.
๋ค, ํ๋ก ๋ฉํ
์ฐ์ค ์ด์์์ ๋๊ฐ์ ์๊ฐ์ ๋ณด๋์ต๋๋ค. ๊ณ ์ ์ ํด์ ํ๋ ค๋ฉด kubectl delete -f manifests/
์ด ํ์ํฉ๋๋ค.
ํ๋ก ๋ฉํ
์ฐ์ค CRD์ ์ค์๋ํ๋ ์ผ๋ถ ์ข
๋ฃ์๊ฐ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.์ด ํน์ ์๋๋ฆฌ์ค์์๋ ๊ฑฐ์ kubernetes ์๋ชป์ด ์๋๋๋ค. ๊ทธ๋ฌ๋ kubernetes๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฒ์ธ์ ๋ ์ฝ๊ฒ ์ฐพ์ ์ ์์ต๋๋ค.์ด ์ค๋ ๋์ ๊ธธ์ด๋ ์ฌ๋ฌ ์์ธ์ด์์ ์ ์์ผ๋ฉฐ ๊ฐ ํน์ ์๋๋ฆฌ์ค์์ ๊ทธ ์์ธ์ ํ์
ํ๋ ๊ฒ์ด ์ฝ์ง ์๊ธฐ ๋๋ฌธ์
๋๋ค.
์ ๋ kubernetes noob์ด๋ฏ๋ก ์ฌ๊ธฐ์ ๋ง์ ์ ๋ณด๋ฅผ ์ ๊ณต ํ ์ ์์ง๋ง ์ข ๋ฃ ์ํ์ 2 ๊ฐ์ ๋ค์ ์คํ์ด์ค๊ฐ ๋ถ์ด ์์ต๋๋ค. ๋ด kubernetes ์ค์ ์ IBM Cloud Private 3.1.2 Community Edition์ ์ฌ์ฉํฉ๋๋ค.
kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.4+icp", GitCommit:"3f5277fa129f05fea532de48284b8b01e3d1ab4e", GitTreeState:"clean", BuildDate:"2019-01-17T13:41:02Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.4+icp", GitCommit:"3f5277fa129f05fea532de48284b8b01e3d1ab4e", GitTreeState:"clean", BuildDate:"2019-01-17T13:41:02Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
kubectl cluster-info
Kubernetes master is running at https://ip
catalog-ui is running at https://ip/api/v1/namespaces/kube-system/services/catalog-ui:catalog-ui/proxy
Heapster is running at https://ip/api/v1/namespaces/kube-system/services/heapster/proxy
image-manager is running at https://ip/api/v1/namespaces/kube-system/services/image-manager:image-manager/proxy
CoreDNS is running at https://ip/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
metrics-server is running at https://ip/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
platform-ui is running at https://ip/api/v1/namespaces/kube-system/services/platform-ui:platform-ui/proxy
kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip1 Ready,SchedulingDisabled etcd,management,master,proxy 23h v1.12.4+icp
ip2 Ready worker 23h v1.12.4+icp
ip3 Ready worker 23h v1.12.4+icp
์ข ๋ฃ ์ํ์์๋ ๋ ๊ฐ์ ๋ค์ ์คํ์ด์ค๊ฐ ์์ต๋๋ค.
kubectl get ns
NAME STATUS AGE
my-apps Terminating 21h
cert-manager Active 23h
default Active 23h
istio-system Active 23h
kube-public Active 23h
kube-system Active 23h
platform Active 22h
psp-example Terminating 18h
services Active 22h
์ด ์ฃผ์์ ์ค๋ช
๋๋๋ก ์ข
๋ฃ์๋ฅผ ํ์ธํ๋ฉด kubernetes
๋ฉ๋๋ค.
kubectl get ns my-apps -o yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"name":"my-apps"}}
creationTimestamp: 2019-04-10T18:23:55Z
deletionTimestamp: 2019-04-11T15:24:24Z
name: my-apps
resourceVersion: "134914"
selfLink: /api/v1/namespaces/my-apps
uid: ccb0398d-5bbd-11e9-a62f-005056ad5350
spec:
finalizers:
- kubernetes
status:
phase: Terminating
์ด์จ๋ ์ข
๋ฃ ์์์ kubernetes
์ ๊ฑฐ๋ฅผ ์๋ํ์ง๋ง ์๋ํ์ง ์์์ต๋๋ค. ๋ํ ์ด ์ฃผ์์ ์ค๋ช
๋ json / api ์ ๊ทผ ๋ฐฉ์์ ์ฌ์ฉํด ๋ณด์์ต๋๋ค. ๋ํ ์๋ํ์ง ์์์ต๋๋ค. ๋ชจ๋ ๋
ธ๋๋ฅผ ๋ค์ ์์ํ๋ ค๊ณ ์๋ํ์ง๋ง ์๋ํ์ง ์์์ต๋๋ค.
๋๋ ๋ํ ๊ฐ์ ์ญ์ ๋ฅผ ์๋ํ์ง๋ง ์๋ํ์ง ์์ต๋๋ค.
kubectl delete namespace my-apps --force --grace-period 0
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
Error from server (Conflict): Operation cannot be fulfilled on namespaces "my-apps": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
์ ๊ฒฝ์ฐ ๋ค์ ์คํ์ด์ค๋ rook-ceph์ด๊ณ , kubectl -n rook-ceph patch cephclusters.ceph.rook.io rook-ceph -p '{"metadata":{"finalizers": []}}' --type=merge
๋ ์ ์๊ฒ ์ ํฉํฉ๋๋ค. ๋ค๋ฅธ ๊ฒฝ์ฐ์๋ ์๋ํฉ๋๋ค.
์ถ์ฒ : https://github.com/rook/rook/blob/master/Documentation/ceph-teardown.md
@ManifoldFR , ๋๋ ๋น์ ๊ณผ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ json ํ์ผ๋ก API ํธ์ถ์ ๋ง๋ค์ด ์๋ํ๋๋ก ๊ด๋ฆฌํ์ต๋๋ค.
kubectl get namespace annoying-namespace-to-delete -o json > tmp.json
๊ทธ๋ฐ ๋ค์ tmp.json์ ํธ์งํ๊ณ"kubernetes"
์ ๊ฑฐํ์ญ์์ค.
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://kubernetes-cluster-ip/api/v1/namespaces/annoying-namespace-to-delete/finalize
๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํด์ผํฉ๋๋ค.
์ ๊ทผ ๋ฐฉ์์ ์ฌ์ฉํ๋ ๋์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ค์ ๋จ๊ณ ๋ฌธ์ ํด๊ฒฐ์ ์ํด ์ด๋ป๊ฒํด์ผํฉ๋๊น?
~ curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://39.96.4.11:6443/api/v1/namespaces/istio-system/finalize
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "namespaces \"istio-system\" is forbidden: User \"system:anonymous\" cannot update resource \"namespaces/finalize\" in API group \"\" in the namespace \"istio-system\"",
"reason": "Forbidden",
"details": {
"name": "istio-system",
"kind": "namespaces"
},
"code": 403
@ManifoldFR , ๋๋ ๋น์ ๊ณผ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ json ํ์ผ๋ก API ํธ์ถ์ ๋ง๋ค์ด ์๋ํ๋๋ก ๊ด๋ฆฌํ์ต๋๋ค.
kubectl get namespace annoying-namespace-to-delete -o json > tmp.json
๊ทธ๋ฐ ๋ค์ tmp.json์ ํธ์งํ๊ณ"kubernetes"
์ ๊ฑฐํ์ญ์์ค.
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://kubernetes-cluster-ip/api/v1/namespaces/annoying-namespace-to-delete/finalize
๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํด์ผํฉ๋๋ค.์ ๊ทผ ๋ฐฉ์์ ์ฌ์ฉํ๋ ๋์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ค์ ๋จ๊ณ ๋ฌธ์ ํด๊ฒฐ์ ์ํด ์ด๋ป๊ฒํด์ผํฉ๋๊น?
~ curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://39.96.4.11:6443/api/v1/namespaces/istio-system/finalize { "kind": "Status", "apiVersion": "v1", "metadata": { }, "status": "Failure", "message": "namespaces \"istio-system\" is forbidden: User \"system:anonymous\" cannot update resource \"namespaces/finalize\" in API group \"\" in the namespace \"istio-system\"", "reason": "Forbidden", "details": { "name": "istio-system", "kind": "namespaces" }, "code": 403
๋ด ๋ฌธ์ ๋์ด ์คํฌ๋ฆฝํธ๋ก ํด๊ฒฐํ ์ ์์ต๋๋ค : https://github.com/ctron/kill-kube-ns/blob/master/kill-kube-ns
.
yup https://github.com/ctron/kill-kube-ns/blob/master/kill-kube-ns ๊ฐ ํธ๋ฆญ์ ์ํํฉ๋๋ค.
set -eo pipefail
die() { echo "$*" 1>&2 ; exit 1; }
need() {
which "$1" &>/dev/null || die "Binary '$1' is missing but required"
}
# checking pre-reqs
need "jq"
need "curl"
need "kubectl"
PROJECT="$1"
shift
test -n "$PROJECT" || die "Missing arguments: kill-ns <namespace>"
kubectl proxy &>/dev/null &
PROXY_PID=$!
killproxy () {
kill $PROXY_PID
}
trap killproxy EXIT
sleep 1 # give the proxy a second
kubectl get namespace "$PROJECT" -o json | jq 'del(.spec.finalizers[] | select("kubernetes"))' | curl -s -k -H "Content-Type: application/json" -X PUT -o /dev/null --data-binary @- http://localhost:8001/api/v1/namespaces/$PROJECT/finalize && echo "Killed namespace: $PROJECT"
์ค์ ๋ก ๋ค์ ์คํ์ด์ค๊ฐ ์ญ์ ๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค.
์ ๊ฒฝ์ฐ kubectl get ns
๋ ์ญ์ ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ํ์ํ์ง ์์ง๋ง kubectl get all -n <namespace>
๋ ๋ชจ๋ ๋ฆฌ์์ค๋ฅผ ์์ ํ๊ณ ๊ฑด์ ํ๊ฒ ํ์ํฉ๋๋ค.
๋
ธ๋์ ๋์ปค ์ปจํ
์ด๋๊ฐ ์ฌ์ ํ ์คํ ์ค์ธ์ง ํ์ธํ์ต๋๋ค.
@glouis ๋ ์์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ์ฌ
๋ง์ ์ฌ๋๋ค์ด ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ์ดํดํ์ง ๋ชปํ๊ณ ์ด ๋ฐฉ๋ฒ์ ๋งน๋ชฉ์ ์ผ๋ก ์นํธํ๋ ๊ฒ์ ๋ณด๋ ๊ฒ์ ์ ๋ง ์ฌํ ์ผ์ ๋๋ค. ๋งค์ฐ ์ถํ๊ณ ์ ์ฌ์ ์ผ๋ก ํด๋ฌ์คํฐ์ ๋ง์ ์์ฌ ๋ฌผ์ ๋จ๊ธธ ์ ์์ต๋๋ค. @javierprovecho๋ ์ด๋ฏธ ์์์ ์ธ๊ธ ํ์ผ๋ฉฐ @liggitt ๋ ๋ค๋ฅธ GitHub ๋ฌธ์ ์์๋ ์ธ๊ธํ์ต๋๋ค .
์์๋ v1beta1.metrics.k8s.io
API ์๋น์ค ๋ฅผ ์์ ํ๊ฑฐ๋ ํ์ํ์ง ์์ ๊ฒฝ์ฐ ์ญ์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
์ฐธ์กฐ # 73405
๋ ๋ฒ์งธ @antoineco ๋ฉ์์ง์ ๋๋ค. ์ฐ๋ฆฌ๋ ๊ณ์ํด์ ๋ค์ ์คํ์ด์ค๊ฐ ๊ณ ์ฐฉ๋์ด ์์๊ธฐ ๋๋ฌธ์ ์๋ ๋ฐ์ค ํ๊ฒฝ ์ค ํ๋์์ ์ด๊ฒ์ ํ ์คํธํ์ต๋๋ค. ์ฝ ํ ๋ฌ ํ์ ๋ชจ๋ ๋์ปค ๋ฐ๋ชฌ์ด ์๋ฌด๋ฐ ์ด์ ์์ด ๋๊ฒฐ๋์์ต๋๋ค. ๋ฆฌ์์ค๋ฅผ ๋จ๊ฒจ ๋๋ฉด์ ์์ฒญ๋ ๋ฉ๋ชจ๋ฆฌ ๋์๊ฐ ๋ฐ์ํ์ต๋๋ค.
๋ง์ ์ํ ์ฐฉ์ค๋ฅผ ๊ฑฐ์ณ ์ด๋ฌํ ์ฃผ์์ ์ฝ์ ํ ๋ค์ ์คํ์ด์ค์ ๋ํ coreos grafana ์คํ์ ๋ํ ์ฌ์ฉ์ ์ง์ ๋ฆฌ์์ค ์ ์๋ก ํ๋ช ๋์์ต๋๋ค. CRD๋ฅผ ๋์ดํ๋ฉด ํด๋น ๋ค์ ์คํ์ด์ค์ ๋ํ ํน์ ๋ฆฌ์์ค๊ฐ ํ์๋์์ต๋๋ค. ๋๋ CRD์ ์ด๋ฆ์ ๋ค์ ์คํ์ด์ค๊ฐ ๋ถ์ด์์ด์ ๋งค์ฐ ์ด์ด ์ข์์ต๋๋ค.
๋ํ ํ๋์ ๊ณ ์ ๋ ๋ค์ ์คํ์ด์ค๊ฐ ์์ผ๋ฉด ๋ ์ด์ ์ญ์ ํ ๋ค์ ์คํ์ด์ค๊ฐ ์ค์ง๋๋ ๊ฒ์ผ๋ก ๋ฐํ์ก์ต๋๋ค. ๋ฐ๋ผ์ CRD๊ฐ์๋ ๋ค์ ์คํ์ด์ค A๊ฐ ์๊ณ ๊ณ ์ ๋ CRD๊ฐ์๋ ๋ค์ ์คํ์ด์ค B๊ฐ ์์ด๋ B๊ฐ ์ฌ๋ผ์ง ๋๊น์ง A์ ๋ชจ๋ ๋ฆฌ์์ค๊ฐ ์ ์ง๋ฉ๋๋ค. ๋๋ ๋งค๋ฒ ๋ง์ ๋ฆฌ์์ค๋ฅผ ๋จ๊ฒจ๋๊ณ ๋ค์ ์คํ์ด์ค A์์ ์์์ ์ค๋ช ํ ์์ ์ ์ํํด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
์ฌ์ ํ ๋๋ฅผ ์ฃฝ์ด๊ณ ์๋ ๊ฒ์ ๋ด๊ฐ ํ์ ๋์ CRD ์ญ์ ์ ์คํจํ ๋ค์ ์คํ์ด์ค ์ ๋ฆฌ๋ฅผ ์ธ๊ธํ๋ ๋ก๊ทธ๋ฅผ ์ฐพ์ ์ ์๊ฑฐ๋ ํ์ฌ ์ํ์ค์ธ ์์ ์ ์ฐพ์ ์ ์๋ค๋ ๊ฒ์ ๋๋ค. ๋๋ ๊ทธ๊ฒ์ด ์ด๋ค CRD์ ๋ถ์ด ์๋์ง ์์๋ด๋ ๋ฐ ํ ์๊ฐ์ ์๋นํด์ผํ์ต๋๋ค. ๋๊ตฐ๊ฐ๊ฐ ๋ ๋ง์ ์ ๋ณด๋ฅผ ์ป๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ด๋์ด๋ฅผ ๊ฐ์ง๊ณ ์๋ค๋ฉด ๊ต์ฅ ํ ๊ฒ ๊ฐ์ ๊ณ ์ฐฉ ๋ ๋ฆฌ์์ค๋ฅผ ์์๋ด๋ ๋ฐ ์์ฒญ๋ ์๊ฐ์ ํ ์ ํ ํ์๊ฐ ์์ต๋๋ค.
@jecafarelli ํ๋ก๋์ ํด๋ฌ์คํฐ์ ๋ํ ์ข์ ํํธ์ ๋๋ค. ํ์ง๋ง ๋ถํํ๊ฒ๋, ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก๋ ์ฃฝ์ผ ์ ์์์ต๋๋ค. ๋ํ ๋์ค์ ์ ์ฒด ํด๋ฌ์คํฐ๋ฅผ ๋ค์ ๋ง๋ค ๊ฒ์์ ์์์ต๋๋ค.
๋ฌธ์ ๋ฅผ ๋ถ์ํด ๋ณด์์ง๋ง์ด ์ค๋ ๋์์ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ๋์์ด๋์ง ์์์ต๋๋ค.
์ด ๊ณต์ ์๋ฃจ์
์ด ๋์์ด๋์์ต๋๋ค : https://success.docker.com/article/kubernetes-namespace-stuck-in-terminating
kubectl edit namespace rook-ceph
์ ๋์ผ ํ์ง ์์ต๋๋ค . ์ญ์ ๋ _ "finalizers"_์ PUT
์์ฒญ์ ํ ๋๊น์ง์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๋ค.
๊ทธ๋์ ๋๋ coreos์ ํจ๊ป ์ด๊ฒ์ ๋ค์ ๋ง๋ฌ๊ณ ์กฐ๊ธ ๋ ๊น์ด ํ๊ณ ๋ค์์ต๋๋ค. ์ด๊ฒ์ ๋ค์ ์คํ์ด์ค๊ฐ์๋ ํด๋ฌ์คํฐ ์ ์ฒด ๋ฆฌ์์ค ์ ์ ๋๋ฌธ์ด๋ฉฐ ๋ ๋์๊ฐ coreos์์ ์ ๋ณด๋ฅผ ์ฟผ๋ฆฌ ํ ์ โโ์๊ธฐ ๋๋ฌธ์ ์ญ์ ํ ์ ์์ต๋๋ค. api ๊ทธ๋ฃน์ ๋ํ ์ ๋ณด๋ฅผ ์ป์ผ๋ ค๊ณ ํ ๋ ์ค๋ฅ๋ฅผ ํ์ํ๋ apiserver ๋ก๊ทธ์์ ์ค๋ฅ๋ฅผ ๋ฐ๊ฒฌํ์ต๋๋ค. ์์ ์ฐธ์กฐ ๋ ๋ฌธ์ ๋ฅผ ์ฌ์ฉํ์ฌ ns๊ฐ ์ ์๊ฒ ๋ถ์ด์๋ ๋ฆฌ์์ค๋ฅผ ๋์ดํ๋ ๋น ๋ฅธ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ์ต๋๋ค.
๋ด๊ฐ ๋ค์ ์คํํ๊ณ ๋ด๊ฐ ์คํํ๋ ๋ค๋ฅธ ๋ค์ ์คํ์ด์ค ๋ฆฌ์์ค๋ฅผ ๊ณ์ ์ถ๊ฐํ๋ฉด ๋์ค์ ์ด๊ฒ์ ์ฌ์ฉํ ๊ฒ์ ๋๋ค.
for ns in `kubectl get ns --field-selector status.phase=Terminating -o name | cut -d/ -f2`;
do
echo "apiservice under namespace $ns"
kubectl get apiservice -o json |jq --arg ns "$ns" '.items[] |select(.spec.service.namespace != null) | select(.spec.service.namespace == $ns) | .metadata.name ' --raw-output
echo "api resources under namespace $ns"
for resource in `kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -o name -n $ns`;
do
echo $resource
done;
done
@jecafarelli ๊ฐ์ฌํฉ๋๋ค. ์ ๋ฌธ์ ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ํด๊ฒฐํ๋ ๋ฐ ๋์์ ์ฃผ์ จ์ต๋๋ค ;-)
cert-manager ๋ค์ ์คํ์ด์ค ๋ด๋ถ์ OpenShift ํด๋ฌ์คํฐ์ cert-manager๋ฅผ ์ค์นํ์ผ๋ฉฐ์ด ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ๋ ค๊ณ ํ ๋ ์ข
๋ฃ ์ํ์์ ๋ฉ์ท์ต๋๋ค. oc delete apiservices v1beta1.admission.certmanager.k8s.io
์คํํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ ๋ ๊ฒ ๊ฐ์ง๋ง ๋ค์ ์คํ์ด์ค๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
@jecafarelli ๊ฐ์ฌํฉ๋๋ค. ์ ๋ฌธ์ ๋ฅผ ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ํด๊ฒฐํ๋ ๋ฐ ๋์์ ์ฃผ์ จ์ต๋๋ค ;-)
cert-manager ๋ค์ ์คํ์ด์ค ๋ด๋ถ์ OpenShift ํด๋ฌ์คํฐ์ cert-manager๋ฅผ ์ค์นํ์ผ๋ฉฐ์ด ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ๋ ค๊ณ ํ ๋ ์ข ๋ฃ ์ํ์์ ๋ฉ์ท์ต๋๋ค.
oc delete apiservices v1beta1.admission.certmanager.k8s.io
์คํํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ ๋ ๊ฒ ๊ฐ์ง๋ง ๋ค์ ์คํ์ด์ค๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
์ฌ๊ธฐ์๋ kubectl delete -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.8/deploy/manifests/00-crds.yaml
๋์์ด๋์์ต๋๋ค.
GKE๋ฅผ ์ฌ์ฉํ๋ 1.13.6
๋ฒ์ ์์๋์ด ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. GKE์ Istio ์ ๋์จ์ ์ฌ์ฉ ์ค์งํ์ฌ ๋ชจ๋ ๊ถํ์ ์๋์ผ๋ก ์ค์น ํ ํ์ ๋ฐ์ํ์ต๋๋ค.
์ด๊ฒ์ ๋ด๊ฐ ์ฝ์ด ๋ณธ ๊ฐ์ฅ ๊ธด ๋ฌธ์ ์ค๋ ๋์ด๋ฉฐ,์ด ๋ฌธ์ ์ ๊ทผ์์ ๋ํ ์ค์ ํฉ์ ๋ ์ฌํ ๋จ๊ณ๊ฐ ์๋ค๋ ์ฌ์ค์ ๋๋์ต๋๋ค. ๋๋ฌด ๋ง์ ๋ค๋ฅธ ๋ฐฉ์์ผ๋ก ๋์ด ์ง ์ ์์ต๋๋ค.
JSON ๋ฐ curl / proxy ๋ฐฉ๋ฒ์ ์์์ ์ฌ๋ฌ ๋ฒ ์ธ๊ธ๋๊ณ https://success.docker.com/article/kubernetes-namespace-stuck-in-terminating์ ๋ฌธ์ํ๋์ด ์ ๋ฅผ ๊ตฌํ์ต๋๋ค.
https://success.docker.com/article/kubernetes-namespace-stuck-in-terminating ์ ์กฐ์ธ์ ์ ๊ทน์ ์ผ๋ก ์ ํดํ๋ฉฐ ๋์ค์ ๋์ผํ ์ด๋ฆ์ ๊ฐ์ง ๋ค์ ์คํ์ด์ค๊ฐ ๋ค์ ์์ฑ๋๋ ๊ฒฝ์ฐ ๊ณ ์ ๋ฆฌ์์ค๊ฐ ์ ๋ฆฌ๋์ง ์๊ณ ๋ค์ ํ์ ๋ ์ ์์ต๋๋ค. .
์ ์ง ๋ ์ญ์ ์ ๊ตฌ์ฒด์ ์ธ ์์ธ์ ๋ฐํ๊ธฐ์ํ ์์ ์ด ์งํ ์ค์ด์ง๋ง ๊ทผ๋ณธ์ ์ธ ๋ฌธ์ ๋ ์ ๋ฆฌ ๋ ๊ฒ์ผ๋ก ํ์ธํ ์์๋ API ์ ํ์ด ์์ผ๋ฏ๋ก ๋ค์ ์คํ์ด์ค ์ญ์ ๊ฐ ํ์ธ ๋ ๋๊น์ง ์ฐจ๋จ๋๋ค๋ ๊ฒ์ ๋๋ค.
๋ํ์ด ๋ค์ ์คํ์ด์ค๊ฐ ์ง์ ๋ apiservice๋ฅผ ์ค์นํ๋ Knative๋ฅผ ์ฌ์ฉํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService
metadata:
labels:
autoscaling.knative.dev/metric-provider: custom-metrics
serving.knative.dev/release: v0.7.1
name: v1beta1.custom.metrics.k8s.io
spec:
group: custom.metrics.k8s.io
groupPriorityMinimum: 100
insecureSkipTLSVerify: true
service:
name: autoscaler
namespace: knative-serving
version: v1beta1
versionPriority: 100
---
knative-serving ns์ ๋ค๋ฅธ ๋ง์ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ํ ์ ๋ฆฌํ์ต๋๋ค. ์์ bash ์คํฌ๋ฆฝํธ์ ๋ํด @jecafarelli ์๊ฒ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
์ฌ๊ธฐ ๋์ฐํ powershell ๋ฒ์ ์ด ์์ต๋๋ค.
$api = kubectl get apiservice -o json | convertfrom-json
#list out the namespaced api items can ignore kube-system
$api.items | % { $_.spec.service.namespace }
#repalce knative-serving with whatever namespace you found
$api.items | ? { $_.spec.service.namespace -eq 'knative-serving' } | ConvertTo-Json
#replace v1beta1.custom.metrics.k8s.io with whatever you found.
k delete apiservice v1beta1.custom.metrics.k8s.io
๋๋ ์ค๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ ์ด ์คํฌ๋ฆฝํธ ๋ ๋๋ฅผ ์ํด ์ผํ์ต๋๋ค.
@ kubernetes / sig-api-machinery-misc
์ด ๋ฒ๊ทธ๋> ๋ ๋์ ์กด์ฌํ์ผ๋ฉฐ ์ฌ์ ํ ๋ฌธ์ ์ ๋๋ค ... ์ด์ ๊ฐ์ ์ธ๋ฐ์ด๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ๊ณํ์ ๋ฌด์์ ๋๊น?
์ด๊ฒ์ ์ ์ด๋ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ์ดํดํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค : https://github.com/kubernetes/kubernetes/pull/80962
๋๋ ๊ฐ์ ๋ฌธ์ ๋ฅผ ๊ฒช๊ณ ์๋ค
k get ns cdnamz-k8s-builder-system -o yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"labels":{"control-plane":"controller-manager"},"name":"cdnamz-k8s-builder-system"}}
creationTimestamp: "2019-08-05T18:38:21Z"
deletionTimestamp: "2019-08-05T20:37:37Z"
labels:
control-plane: controller-manager
name: cdnamz-k8s-builder-system
resourceVersion: "5980028"
selfLink: /api/v1/namespaces/cdnamz-k8s-builder-system
uid: 3xxxxxxx
spec:
finalizers:
- kubernetes
status:
phase: Terminating
k get ns
NAME STATUS AGE
cdnamz-k8s-builder-system Terminating 4h20m
๋ค์ ์คํ์ด์ค ์ปจํธ๋กค๋ฌ๋ ๋ค์ ์คํ์ด์ค ์ํ์ ์กฐ๊ฑด์๋ณด๊ณ ํด์ผํ๋ฉฐ ํด๋ผ์ด์ธํธ๋์ด๋ฅผ๋ณด๊ณ ํด์ผํฉ๋๋ค. KEP๊ฐ ํ์ํ์ง๋ง ๋๊ตฐ๊ฐ๊ฐ ๊ทธ๊ฒ์ ๋ฐ์ ๊ฒ์ฆ ํ ์ ์๋ค๋ฉด ๋งค์ฐ ๊ฐ๋จํด์ผํฉ๋๋ค.
@timothysc @smarterclayton ๋งํ๋ค ์ ํํ ๋ฌด์์ํ๊ณ ๋นํ (์ด๋๊ฐ์)์ PR์ด์๋ค (๋๋์ด์๋ค).
์ด๊ฒ์ ๋ํด ๋ ๋ค๋ฅธ github ๋ฌธ์ ๊ฐ ์๋ค๊ณ ํ์ ํฉ๋๊น?
๋ค PR์ ์ฌ๊ธฐ ์์ต๋๋ค : https://github.com/kubernetes/kubernetes/pull/73405
๋ด๊ฐ ํ์ค์ด๋ผ๊ณ ์๊ฐํ๋ ๋ฌธ์ ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. https://github.com/kubernetes/kubernetes/issues/70916
์ ์๊ฒ ๋์์ด ๋ ๋ฆฌ์์ค๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. https://www.ibm.com/support/knowledgecenter/en/SSBS6K_3.1.1/troubleshoot/ns_terminating.html
@slassh ์์ ์ ์ํ ์๋ฃจ์
๊ณผ ๋น์ทํ์ง๋ง kubectl proxy
๋ฅผ ์ฌ์ฉํ์ฌ ๋ก์ปฌ ํ๋ก์๋ฅผ ๋ง๋ค๊ณ curl
๋ช
๋ น์ ๋์ IP๋ฅผ ์์ธก ๊ฐ๋ฅํ๊ฒ ๋ง๋ญ๋๋ค.
-
ํธ์ง :์ด ๋ต๋ณ ์๋์ ์ฌ๋ฌ ๋ฒ ์ธ๊ธ ํ๋ฏ์ด์ด ์๋ฃจ์ ์ ๋๋ฌ์ด ํดํน์ด๋ฉฐ ํด๋ฌ์คํฐ์ ์ผ๋ถ ์ข ์ ๋ฆฌ์์ค๋ฅผ ๋จ๊ธธ ์ ์์ต๋๋ค. ์์ ์ ์ฑ ์ํ์ ์ฌ์ฉํ๊ณ ๊ฐ๋ฐ ํด๋ฌ์คํฐ์์ ๋น ๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ๋ง ์ฌ์ฉํ์ญ์์ค (ํ๋ก๋์ ํด๋ฌ์คํฐ์์๋ ์ฌ์ฉํ์ง ๋ง์ญ์์ค).
์์ ๋ฌธ์์ ์ค๋ช ๋๋๋ก ์ข ๋ฃ์๋ฅผ ์ง์ ์ ๊ฑฐํ๋ฉด ๊ฒฐ๊ณผ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ์ญ์ ๋ณด๋ฅ ์ค์ด๋ ๋ฆฌ์์ค๋ ๋ค์ ์คํ์ด์ค๊ฐ ํด์ ๋ ํ์๋ ํด๋ฌ์คํฐ์ ๊ณ์ ์ ์๋ฉ๋๋ค. ์ด๊ฒ์ด ์ข ๋ฃ ์์ ๋ชฉ์ ์ ๋๋ค. ns ์ญ์ ๋ฅผ ํ์ฉํ๊ธฐ ์ ์ ๋ชจ๋ ์ข ์ ํญ๋ชฉ์ด ์ ๊ฑฐ๋์๋์ง ํ์ธํฉ๋๋ค.
์ ์ฌํ ์ง๋ฌธ์์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฐพ์์ต๋๋ค.
NAMESPACE=<namespace-name>
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
์ ์ฌํ ์ง๋ฌธ์์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฐพ์์ต๋๋ค.
NAMESPACE=<namespace-name> kubectl proxy & kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
๊ฐ์ฌํฉ๋๋ค!
์ ์๋ํฉ๋๋ค.
์ด ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ์ฌ ๊ฐ๋จํ ์ฑ์ ๋ง๋ญ๋๋ค. https://github.com/jenoOvchi/k8sdelns
๋น ๋ฅธ ์ญ์ ๋ฅผ ์ํด ์ฌ์ฉํ๊ณ ๋๊ตฐ๊ฐ์๊ฒ ๋์์ด๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
Kubernetes 1.12.2 ๋ค์ ์คํ์ด์ค๋ Terminating ์ํ์ ๋๋ค. ๋๋๋ก ns์ yaml์ ์์ ํ์ฌ ์ข ๋ฃ์๋ฅผ ์ญ์ ํ ์ ์์ต๋๋ค. api๋ก ์ญ์ ํ ์ ์์ต๋๋ค. ์ญ์ ํ ์ ์์ต๋๊น? ์ํฉ์ ์ด๋ป์ต๋๊น? ๊ตฌ์ฒด์ ์ผ๋ก ์ถ์ ํ์ต๋๊น (์ ์ ์กฐ๊ฑด :์ด ns์๋ ๋ฆฌ์์ค๊ฐ ์์), ํฌ์ธํฐ๋ฅผ ์ป์ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ๊ฐ์ฌํฉ๋๋ค!
๋ค์ ๋งํ์ง๋ง, ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ์ง ๋ง์ญ์์ค. ์ด์ ๊ฐ ์์ต๋๋ค. ๋์ ๋ค์์ ์ํํ์ฌ NS์์ ์ญ์ ๋ณด๋ฅ์ค์ธ ๋ฆฌ์์ค๋ฅผ ์ฐพ์ผ์ญ์์ค.
kubectl get apiservice|grep False
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n $your-ns-to-delete
๋ฅผ ํตํด ์ฌ์ ํ ์กด์ฌํ๋ ๋ชจ๋ ๋ฆฌ์์ค ์ฐพ๊ธฐ (Kudos์์ Jordan๊น์ง)์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ์ฑ ์ ์ ๋ฆฌ ๋ฉ์ปค๋์ฆ์ ๋จ๋ฝ์ํค๋ ๊ฒ์ด ์๋๋ผ ์ ๋ฆฌ๊ฐ ์ฑ๊ณตํ์ง ๋ชปํ๊ฒํ๋ ์์ธ์ ์ฐพ๋ ๊ฒ์ ๋๋ค.
๋ค์ ๋งํ์ง๋ง, ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ์ง ๋ง์ญ์์ค. ์ด์ ๊ฐ ์์ต๋๋ค. ๋์ ๋ค์์ ์ํํ์ฌ NS์์ ์ญ์ ๋ณด๋ฅ์ค์ธ ๋ฆฌ์์ค๋ฅผ ์ฐพ์ผ์ญ์์ค.
- apiservice๋ฅผ ์ฌ์ฉํ ์ ์์ด ๋ฆฌ์์ค๋ฅผ ์ ๊ณตํ์ง ์๋์ง ํ์ธ :
kubectl get apiservice|grep False
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n $your-ns-to-delete
๋ฅผ ํตํด ์ฌ์ ํ ์กด์ฌํ๋ ๋ชจ๋ ๋ฆฌ์์ค ์ฐพ๊ธฐ (Kudos์์ Jordan๊น์ง)์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ์ฑ ์ ์ ๋ฆฌ ๋ฉ์ปค๋์ฆ์ ๋จ๋ฝ์ํค๋ ๊ฒ์ด ์๋๋ผ ์ ๋ฆฌ๊ฐ ์ฑ๊ณตํ์ง ๋ชปํ๊ฒํ๋ ์์ธ์ ์ฐพ๋ ๊ฒ์ ๋๋ค.
๋น์ ์ด ์ผ๋ง๋ ์ณ์๊ฐ.
์ ๊ฒฝ์ฐ์๋ Operator Framework apiservice์ ํฌ๋๊ฐ ์ญ์ ๋๊ณ ํ๋ก์ธ์ค ์ข
๋ฃ๊ฐ ์ฐจ๋จ๋์์ต๋๋ค.
์ฌ์ฉํ์ง ์๋ apiservice ์ ๊ฑฐ (kubectl delete apiservice
์๋ ํ์ธ์, ์ฝ๋ ๋๊ฒฐ์ด ๋ฉฐ์น (๋ชฉ์์ผ, ํ๋ฃจ์ ๋, ํํ์ ํ์ค์) ๋ด์ ๋ฐ์ํ๋ฏ๋ก์ด ๋ฌธ์ ๊ฐ v1.16์์ ํด๊ฒฐ๋๊ฑฐ๋ v1.17๋ก ์ด๋๋์๋์ง ํ์ธํด์ผํฉ๋๋ค. ๊ทธ๊ฒ์ ์ํ์ ๋ํด ์ธ๊ธ ํ ์ ์์ต๋๊น?
ํ์ฌ GKE ๋ฆด๋ฆฌ์ค๋ก ๋ฐฑ ํฌํธ ๋๋์? ์์ง "์ข ๋ฃ ์ค"์ธ ์์์ ๋ค์ ์คํ์ด์ค๊ฐ์๋ ํด๋ฌ์คํฐ๊ฐ ์์ต๋๋ค.
์ด ์ผ์ ํ ํ์๋ @squarelover ? https://github.com/kubernetes/kubernetes/issues/60807#issuecomment -524772920
@josiahbjorgaard ๋ฐฉ๊ธ PR์ ์น์ธํ์ต๋๋ค. 1.16์ ๋ํด์ด ์์ ์ ์ํ ํ ์ ๋ถ์ ๋๋ค.
https://github.com/kubernetes/kubernetes/pull/73405 ๋ ์์ ์ธ๊ธ ํ PR์ ๋๋ค.
๋ณํฉ๋์์ต๋๋ค. ์ฐ๋ฆฌ๊ฐ ํ ์์๋ ์ผ์ด ๋์์ ๊ฒ ๊ฐ์ง๋ง, # 70916์ ๋ํ ํฅํ ์๊ฒฌ์ ๋ถํ๋๋ฆฝ๋๋ค.
๋ค์ ๋งํ์ง๋ง, ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ์ง ๋ง์ญ์์ค. ์ด์ ๊ฐ ์์ต๋๋ค. ๋์ ๋ค์์ ์ํํ์ฌ NS์์ ์ญ์ ๋ณด๋ฅ์ค์ธ ๋ฆฌ์์ค๋ฅผ ์ฐพ์ผ์ญ์์ค.
- apiservice๋ฅผ ์ฌ์ฉํ ์ ์์ด ๋ฆฌ์์ค๋ฅผ ์ ๊ณตํ์ง ์๋์ง ํ์ธ :
kubectl get apiservice|grep False
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n $your-ns-to-delete
๋ฅผ ํตํด ์ฌ์ ํ ์กด์ฌํ๋ ๋ชจ๋ ๋ฆฌ์์ค ์ฐพ๊ธฐ (Kudos์์ Jordan๊น์ง)์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ์ฑ ์ ์ ๋ฆฌ ๋ฉ์ปค๋์ฆ์ ๋จ๋ฝ์ํค๋ ๊ฒ์ด ์๋๋ผ ์ ๋ฆฌ๊ฐ ์ฑ๊ณตํ์ง ๋ชปํ๊ฒํ๋ ์์ธ์ ์ฐพ๋ ๊ฒ์ ๋๋ค.
๋๋ถ๋ถ์ ๊ฒฝ์ฐ Metric-Server๊ฐ ์ค์น๋์ด์์ ์ ์์ต๋๋ค. ํน์ ๋ค์ ์คํ์ด์ค์ ๋ฐฐํฌํ๋ ํฌ๋๊ฐ ๋ฉํธ๋ฆญ ์์ง์ ์ฐพ์ ๋. Metric-server์ ์ฐ๊ฒฐ๋์ด ์์ต๋๋ค. ๋ฐ๋ผ์ ํด๋น ๋ค์ ์คํ์ด์ค์ ๋ชจ๋ ๋ฆฌ์์ค๋ฅผ ์ญ์ ํ ํ์๋ metric-server๋ ์ด๋ป๊ฒ ๋ ํด๋น ๋ค์ ์คํ์ด์ค์ ์ฐ๊ฒฐ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ฉด ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ์ ์์ต๋๋ค.
์ด ๊ฒ์๋ฌผ์ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ์์๋ ์ด์ ๋ฅผ ์๋ณํ๋ ๋ฐ ๋์์ด๋ฉ๋๋ค. ๊ทธ๋์ ์์ ๋ฐฉ๋ฒ.
๋ค์ ์คํ์ด์ค์์๋ ๋ชจ๋ ํญ๋ชฉ์ ์ค์ ๋ชฉ๋ก์ ์ป์ผ๋ ค๋ฉด ๋ค์์ ์๋ํ์ญ์์ค. kubernetes / kubectl # 151 (์ฃผ์)
๊ทธ๋ฐ ๋ค์ ๊ฐ ๊ฐ์ฒด์ ๋ํด
kubectl delete
๋๋kubectl edit
๋ฅผ ์ํํ์ฌ ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํฉ๋๋ค.
์ด ์๋ฃจ์ ์ ๋์๊ฒ ์ ์ฉํฉ๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
์๋ ํ์ธ์ ์ฌ๋ฌ๋ถ,
Terminating status : https://github.com/thyarles/knsk ์์ ๋ค์ ์คํ์ด์ค๋ฅผ ์ฝ๊ฒ ์ญ์ ํ ์์๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค์์ต๋๋ค
๊ฐ์ฌ.
๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ๋ฉด '์ข ๋ฃ ์ค'์ํ๋ก ๋ฉ์ถ๋ค๋ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์์ stpes๋ฅผ ๋ฐ๋ผ yaml ํ์ผ์ ์ข ๋ฃ ์์์ 'kubernetes'๋ฅผ ์ ๊ฑฐํ์ต๋๋ค. ํจ๊ณผ๊ฐ์๋ค.
๊ทธ๋ฌ๋ ์ฐ๋ฆฌ๋ ์ถ๊ฐ ๋จ๊ณ๋ฅผ ์ํํด์ผํ๋ ์ด์ ๋ฅผ ๋ชจ๋ฆ ๋๋ค. kubectl delete ns foonamespace๋ฅผ ์ํํด์ผํ๋ฉฐ ์ญ์ ํด์ผํฉ๋๋ค. ์๋ฌด๋ ๋์๊ฒ ์ด์ ๋ฅผ ์ค ์ ์์ต๋๊น? ๊ฐ์ฌํฉ๋๋ค!
์๋ ํ์ธ์ @ xzhang007 ,
๋ค์ ์คํ์ด์ค ์ญ์ ๊ฐ Terminating ์ํ์์ ๋ฉ์ถ ์ด์ ๋ฅผ ๋ฐ๊ฒฌํ๋ฉด ์๋ ค์ฃผ์ธ์. ๋๋ ์ข์ ๋๋ต์ ์ ์ ์๋ํ์ง๋ง ์๋ฌด๊ฒ๋ ์์๋ค. ๊ทธ๋ฐ ๋ค์ ์์ธ์ ๋ฐ๊ฒฌํ๊ณ ์์ ํ ๋๊น์ง ๋ด ์ถ์ ๋ ์ฝ๊ฒ ๋ง๋๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค์์ต๋๋ค.
๊ฐ์ฌํฉ๋๋ค.
@thyales ์ง๊ธ๊น์ง ๋ต์ ์ฐพ์ง ๋ชปํ ๊ฒ ๊ฐ์ต๋๋ค.
์ฐ๋ฆฌ์ ๊ฒฝ์ฐ ์ฐ๋ฆฌ๋ webhhoks์ finalizer ์ค ํ๋๊ฐ
์ฌ์ฉ์ ๋ค์ ์คํ์ด์ค์ ์ด๊ณ ์๋ ํฌ๋์ ๋๋ฌํ์ต๋๋ค.
์ญ์ ๋์์ต๋๋ค.
ํฌ๋๊ฐ ์ญ์ ๋๋ฉด ์ข
๋ฃ๊ฐ ์ค๋จ๋์์ต๋๋ค.
>
@ xzhang007 @alvaroaleman ์ด ์ ๊ณต ํ ๋ต๋ณ์ ๋ณด์ จ์ต๋๊น ? ์ฐ๋ฆฌ์๊ฒ๋ ์์ธ์ด ๋ฌด์์ธ์ง ์์๋ด๋ ๋ฐ ์ถฉ๋ถํ์ต๋๋ค.
๋ค์ ๋งํ์ง๋ง, ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ์ง ๋ง์ญ์์ค. ์ด์ ๊ฐ ์์ต๋๋ค. ๋์ ๋ค์์ ์ํํ์ฌ NS์์ ์ญ์ ๋ณด๋ฅ์ค์ธ ๋ฆฌ์์ค๋ฅผ ์ฐพ์ผ์ญ์์ค.
- apiservice๋ฅผ ์ฌ์ฉํ ์ ์์ด ๋ฆฌ์์ค๋ฅผ ์ ๊ณตํ์ง ์๋์ง ํ์ธ :
kubectl get apiservice|grep False
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n $your-ns-to-delete
๋ฅผ ํตํด ์ฌ์ ํ ์กด์ฌํ๋ ๋ชจ๋ ๋ฆฌ์์ค ์ฐพ๊ธฐ (Kudos์์ Jordan๊น์ง)์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ์ฑ ์ ์ ๋ฆฌ ๋ฉ์ปค๋์ฆ์ ๋จ๋ฝ์ํค๋ ๊ฒ์ด ์๋๋ผ ์ ๋ฆฌ๊ฐ ์ฑ๊ณตํ์ง ๋ชปํ๊ฒํ๋ ์์ธ์ ์ฐพ๋ ๊ฒ์ ๋๋ค.
๋ํ์ด ๋ฌธ์ ๊ฐ ์ข ๊ฒฐ๋์์ ๋ ๋ค์ ์คํ์ด์ค๊ฐ Terminating์์ ๋ฉ์ถ ์ด์ ๋ฅผ ๋ช ํํํ๋ ๋ฐฉ๋ฒ์ ๋ ผ์ํ๊ธฐ ์ํด ์ฐธ์กฐ ๋ ์ ํฐ์ผ์ด์์์ต๋๋ค. ์ด ๋ซํ ๋ฌธ์ ๋์ ๊ฑฐ๊ธฐ์์ ๋ํ๋ฅผ ๋๋๋ ๊ฒ์ด ์ข์ต๋๋ค.
๋ณํฉ๋์์ต๋๋ค. ์ฐ๋ฆฌ๊ฐ ํ ์์๋ ์ผ์ด ๋์์ ๊ฒ ๊ฐ์ง๋ง, # 70916์ ๋ํ ํฅํ ์๊ฒฌ์ ๋ถํ๋๋ฆฝ๋๋ค.
@ jeff-knurek ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ด์ด์ผํฉ๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
์ฐ๋ฆฌ์ ๊ฒฝ์ฐ์๋ cert-manager
์ ์๋ชป๋ ์
๊ทธ๋ ์ด๋๋ก ์ข
๋ฃ์๊ฐ ์ค๋จ๋์์ต๋๋ค. https://github.com/jetstack/cert-manager/issues/1582
$ kube get apiservice
NAME SERVICE AVAILABLE AGE
v1. Local True 43d
v1.apps Local True 43d
v1.authentication.k8s.io Local True 43d
v1.authorization.k8s.io Local True 43d
v1.autoscaling Local True 43d
v1.batch Local True 43d
v1.coordination.k8s.io Local True 43d
v1.networking.k8s.io Local True 43d
v1.rbac.authorization.k8s.io Local True 43d
v1.scheduling.k8s.io Local True 43d
v1.storage.k8s.io Local True 43d
v1alpha1.certmanager.k8s.io Local True 3d22h
v1alpha1.crd.k8s.amazonaws.com Local True 43d
v1beta1.admission.certmanager.k8s.io cert-manager/cointainers-cointainers-cert-manager-webhook False (MissingEndpoints) 60m
v1beta1.admissionregistration.k8s.io Local True 43d
v1beta1.apiextensions.k8s.io Local True 43d
v1beta1.apps Local True 43d
v1beta1.authentication.k8s.io Local True 43d
v1beta1.authorization.k8s.io Local True 43d
v1beta1.batch Local True 43d
v1beta1.certificates.k8s.io Local True 43d
v1beta1.coordination.k8s.io Local True 43d
v1beta1.events.k8s.io Local True 43d
v1beta1.extensions Local True 43d
v1beta1.networking.k8s.io Local True 43d
v1beta1.node.k8s.io Local True 43d
v1beta1.policy Local True 43d
v1beta1.rbac.authorization.k8s.io Local True 43d
v1beta1.scheduling.k8s.io Local True 43d
v1beta1.storage.k8s.io Local True 43d
v1beta1.webhook.cert-manager.io cert-manager/cointainers-cointainers-cert-manager-webhook False (MissingEndpoints) 3d22h
v1beta2.apps Local True 43d
v2beta1.autoscaling Local True 43d
v2beta2.autoscaling Local True 43d
์๋
ํ์ธ์.
๋ด ์ผ์ด์ค ๋ค์ ์คํ์ด์ค๋ https://github.com/rancher/rancher/issues/21546#issuecomment -553635629
์๋ง๋ ๋์์ด ๋ ๊ฒ์ ๋๋ค.
https://medium.com/@newtondev/how -to-fix-kubernetes-namespace-deleting-stuck-in-terminating-state-5ed75792647e
์ด๊ฒ์ ๋๋ฅผ์ํ ์ฑํผ์ธ์ฒ๋ผ ์๋ํ์ต๋๋ค.
๋๋ ๋ํ ๋์ผํ ๋ฌธ์ ์ ์ง๋ฉดํ์ผ๋ฉฐ ์ด์ ๋ ์ ์๋ํฉ๋๋ค. ๋ค์ ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ญ์์ค.
@zerkms ๊ธ์, ๋๋ก๋ ํฉ๋ฒ์ ์ธ ์กฐ์ธ์ด์ง ์์ต๋๊น? ์ข ์ข ๋๊ธฐ์ค์ธ ์ข ๋ฃ์๋ ๋ค์ ์คํ์ด์ค ์ญ์ ์ ์ผ๋ถ๋ก ์ญ์ ๋ ๊ฐ์ฒด๊ฐ ์ ๊ณตํ๋ ๋ฐ ์ฌ์ฉ๋์์ต๋๋ค. ์ด ๊ฒฝ์ฐ, ๋ ์ด์ ๊ธฐ๋ค๋ฆด ํ์๊ฐ ์๊ธฐ ๋๋ฌธ์-๋ ์ด์ ๋ง๋ฌด๋ฆฌ๋ฅผ ํ ์์๋ ๊ฒ์ด ์์ต๋๋ค-๊ธฐ์ฌ์์ ์ค๋ช ํ๋ ๋ฐฉ์๋๋ก ๊ฐ์ฒด๋ฅผ ํจ์นํ๋ ๊ฒ์ด ์ ์ผํ ์ต์ ์ ๋๋ค _.
์ด ๊ธฐ์ฌ๋ ๊ธฐ์ฌ ์๋จ์ ๋งํฌ ๋ ์๋ ค์ง ๋ฌธ์ ํ์ด์ง์ ๋์ด๋ ๋จ๊ณ๋ฅผ ์ ์ฉํ์ฌ ๋ฌธ์ ๊ฐ _ ํด๊ฒฐ๋์ง ์์ ๊ฒฝ์ฐ์๋ง ์ ์ฉ๋๋ฉฐ, ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๋งํฌ ํ ๋๊ธ์ด ๋ฐ๋ณต๋๋ ์กฐ์ธ์ ๋๋ค.
@zerkms ๊ธ์, ๋๋ก๋ ํฉ๋ฒ์ ์ธ ์กฐ์ธ์ด์ง ์์ต๋๊น? ์ข ์ข ๋๊ธฐ์ค์ธ ์ข ๋ฃ์๋ ๋ค์ ์คํ์ด์ค ์ญ์ ์ ์ผ๋ถ๋ก ์ญ์ ๋ ๊ฐ์ฒด๊ฐ ์ ๊ณตํ๋ ๋ฐ ์ฌ์ฉ๋์์ต๋๋ค.
๋ค์ ์คํ์ด์ค์ spec.finalizer์ ๋ํด ์ด๊ฒ์ด ์ฌ์ค ์ธ ๊ฒ์ ๋ณธ ์ ์ด ์์ต๋๋ค. ๋ด๊ฐ ๋ณธ ๋ชจ๋ ์ธ์คํด์ค๋ ๋ค์ ์คํ์ด์ค ์ ๋ฆฌ ์ปจํธ๋กค๋ฌ์ ๊ด๋ จ๋์ด ์์ผ๋ฉฐ ๋ค์ ์คํ์ด์ค์ ์๊ตฌ ๊ฐ์ฒด (์ด๋๋ฐ์ด์ค๊ฐ etcd์์ ์ข์ด ๋ ๊ฒ์) ๋๋ ์๋ตํ์ง ์๋ ์ง๊ณ API (๋ค์ ์คํ์ด์ค spec.finalizer๋ฅผ ์ ๊ฑฐํ๋ฉด ๊ฑด๋ ๋ธ ์ ์์)๋ก ์ธํด ๋ฐ์ํ์ต๋๋ค. ๋๊ธฐ ์ค์ด๋ฉฐ ํด๋น API์์ ์ง์๋๋ ๋ฆฌ์์ค๋ ์ข์ด)
์ด ๊ธฐ์ฌ๋ ๋ค์ ์คํ์ด์ค ๋ง๋ฌด๋ฆฌ๋ฅผ ์ฐํํ๋ฉด ๋ค์ ์คํ์ด์ค ๋ฆฌ์์ค๊ฐ ์คํ ๋ฆฌ์ง์ ์ข์ด ๋ ์ํ์ด ์๋ค๋ ๊ฒฝ๊ณ ๋ฅผํ์ง ์์ผ๋ฉฐ ๊ถ์ฅํ์ง ์์ต๋๋ค.
๋ค์ ์คํ์ด์ค์ spec.finalizer์ ๋ํ ์ฌ์ค์ ๋ณธ ์ ์ด ์์ต๋๋ค.
๋ค, ๋ง์ต๋๋ค. ์ด๊ฒ์์ด ์ข
๋ฃ์๊ฐ kubernetes ์์ฒด์ ์ํด ๊ตฌํ๋๊ธฐ ๋๋ฌธ์
๋๋ค. ๊ทธ๋ฌ๋ ํด๋น ๋ค์ ์คํ์ด์ค ๋ด์ ๊ฐ์ฒด์ ๋ค๋ฅธ ์ข
๋ฃ์๊ฐ์์ ์ ์์ผ๋ฉฐ, ํด๋น ๋ค์ ์คํ์ด์ค์ ๊ฐ์ฒด์ ์ํด ๊ตฌํ ๋ ์ ์์ต๋๋ค. ์ต๊ทผ์ ๋ง๋ ํ ๊ฐ์ง ์๋ https://appscode.com/products/stash/
์
๋๋ค.
stash-operator ๋ฐฐ์น์์ ์๋น์ค ํ ์ผ๋ถ CRD์ ์ข ๋ฃ์๋ฅผ ๋ฐฐ์นํฉ๋๋ค. ๊ทธ๋ฌ๋ stash-operator๊ฐ ์ด๋ฏธ ์ญ์ ๋์์ผ๋ฏ๋ก ํด๋น CRD์์ ์ข ๋ฃ ์ ํ์๋ฅผ ์ ๊ฑฐ ํ ์์๋ ๊ฒ์ ์์ผ๋ฉฐ ๋ค์ ์คํ์ด์ค ์ญ์ ๊ฐ ์ค๋จ๋ฉ๋๋ค. ์ด ๊ฒฝ์ฐ ํด๋น ์ข ๋ฃ์๋ฅผ ํจ์น (๋ค์ ์คํ์ด์ค ์์ฒด๊ฐ ์๋๋ผ ํด๋น ๊ฐ์ฒด)ํ๋ ๊ฒ์ด ์ ์ผํ๊ฒ ํ๋ช ํ ์์ ์ ๋๋ค.
์ดํด๊ฐ ๋๊ธธ ๋ฐ๋๋๋ค.
์ด ๊ฒฝ์ฐ ํด๋น ์ข ๋ฃ์๋ฅผ ํจ์น (๋ค์ ์คํ์ด์ค ์์ฒด๊ฐ ์๋๋ผ ํด๋น ๊ฐ์ฒด)ํ๋ ๊ฒ์ด ์ ์ผํ๊ฒ ํ๋ช ํ ์์ ์ ๋๋ค.
์ณ์. "๋ชจ๋ ๋ฆฌ์์ค ์ญ์ "์ ๋ฆฌ ์๋๋ฆฌ์ค์์๋ ์ด์ ๋ฐ๋ํ์ง ์์ง๋ง ๋งํฌ ๋ ๋ฌธ์๊ฐ ์๋ดํ๋ ๋ด์ฉ์ด ์๋๋๋ค. ๋ค์ ์คํ์ด์ค์์ spec.finalizer๋ฅผ ์ ๊ฑฐํ๋ ๋ฐฉ๋ฒ์ ์ค๋ช ํฉ๋๋ค.
๋จผ์ ์์ ์ปคํผ๋ฅผ ๋ง์๊ณ ๊ธด์ฅ์ ํ๊ณ ์ด์ k8s ๋ง์คํฐ ๋ ธ๋๋ก ์ด๋ํ์ญ์์ค.
kubectl ํด๋ฌ์คํฐ ์ ๋ณด
Kubernetes ๋ง์คํฐ๋ https : // localhost : 6443์์ ์คํ ์ค์
๋๋ค.
KubeDNS๋ https : // localhost : 6443 / api / v1 / namespaces / kube-system / services / kube- dns : dns / proxy์์ ์คํ๋ฉ๋๋ค.
ํด๋ฌ์คํฐ ๋ฌธ์ ๋ฅผ ์ถ๊ฐ๋ก ๋๋ฒ๊ทธํ๊ณ ์ง๋จํ๋ ค๋ฉด 'kubectl cluster-info dump'๋ฅผ ์ฌ์ฉํ์ญ์์ค.
์ด์ kube-proxy๋ฅผ ์คํํ์ญ์์ค.
kubectl ํ๋ก์ ๋ฐ
127.0.0.1:8001์ ๊ฒ์ฌ ์์
๋์ค์ ์ญ์ ํ๋ ค๋ฉด ID๋ฅผ ์ ์ฅํ์ญ์์ค. :)
ํ์ผ์ ๋ฃ์ด
ํ์ผ ํธ์ง ๋ฐ ์ข
๋ฃ ์ ์ ๊ฑฐ
},
"spec": {
"์ข
๋ฃ ์": [
"์ฟ ๋ฒ ๋ฅด๋ค ํ
์ค"
]
},
ํธ์ง ํ ๋ค์๊ณผ ๊ฐ์ด ๋ณด์ผ ๊ฒ์
๋๋ค ๐
},
"spec": {
"์ข
๋ฃ ์": [
]
},
๊ฑฐ์ ๋ค ์์ด์ ๐
curl -k -H "Content-Type : application / json"-X PUT --data-binary @ tmp.json http://127.0.0.1 : 8001 / api / v1 / namespaces / $ {NAMESPACE} / finalize
๊ทธ๋ฆฌ๊ณ ์ฌ๋ผ์ก์ต๋๋ค ๐
๋ค์ ๋งํ์ง๋ง, ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ์ง ๋ง์ญ์์ค. ์ด์ ๊ฐ ์์ต๋๋ค. ๋์ ๋ค์์ ์ํํ์ฌ NS์์ ์ญ์ ๋ณด๋ฅ์ค์ธ ๋ฆฌ์์ค๋ฅผ ์ฐพ์ผ์ญ์์ค.
- apiservice๋ฅผ ์ฌ์ฉํ ์ ์์ด ๋ฆฌ์์ค๋ฅผ ์ ๊ณตํ์ง ์๋์ง ํ์ธ :
kubectl get apiservice|grep False
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n $your-ns-to-delete
๋ฅผ ํตํด ์ฌ์ ํ ์กด์ฌํ๋ ๋ชจ๋ ๋ฆฌ์์ค ์ฐพ๊ธฐ (Kudos์์ Jordan๊น์ง)์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ์ฑ ์ ์ ๋ฆฌ ๋ฉ์ปค๋์ฆ์ ๋จ๋ฝ์ํค๋ ๊ฒ์ด ์๋๋ผ ์ ๋ฆฌ๊ฐ ์ฑ๊ณตํ์ง ๋ชปํ๊ฒํ๋ ์์ธ์ ์ฐพ๋ ๊ฒ์ ๋๋ค.
์๋ค ์! @alvaroaleman์ด ์ ๊ณตํ๋ ํ์ ์๋ ๋ค์ ์คํ์ด์ค๋ฅผ ํ๋ ์ญ์ ํ๊ธฐ ์ ์ ๊นจ๋ํ ์ญ์ ๋ฅผ ๊ฒ์ฌํ๊ณ
https://github.com/thyarles/knsk ์คํฌ๋ฆฝํธ์ ๊ธฐ๋ฅ :
๋์์ด ๋์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
@thyarles ์ ๋ง ๊ฐ์ฌํฉ๋๋ค. ๋๋ ๋น์ ์ ๋ฐฉ์์ผ๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
$ kubectl get apiservices๋ ์ฌ์ฉํ ์์๋ ์๋น์ค๋ฅผ ํ์ธํ๊ณ , ์ฌ์ฉ ๊ฐ๋ฅํ ์๋น์ค๋ฅผ ์ญ์ ํ๋ฉด $ kubectl delete apiservice [service-name]์ ์ํด false๊ฐ๋ฉ๋๋ค. ๊ทธ ํ์๋ ๋ค์ ์คํ์ด์ค ์ญ์ ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ฐ๋ฆฌ ํ์๋ ์ฌ์ฉํ ์์๋ 3 ๊ฐ์ apiservices, v1beta1.admission.certmanager.k8s.io, v1beta1.metrics.k8s.io ๋ฐ v1beta1.webhook.certmanager.k8s.io๊ฐ ์์ต๋๋ค.
๋ฉํธ๋ฆญ apiserver๊ฐ ์คํ๋๊ณ ์์ง ์์ผ๋ฉด ํด๋ฌ์คํฐ๊ฐ ๋ค์ ์์๋์์ผ๋ฉฐ APIService๋ฅผ ์ ๊ฑฐํ๋ ๊ฒ๋ง์ผ๋ก ๊ทผ๋ณธ ์์ธ์ด ์ค์ ๋ก ํด๊ฒฐ๋์ง๋ ์์ต๋๋ค.
@lavalamp ๋ฉํธ๋ฆญ์ ์ฌ์ฉํ ์์๋ apiservice์ ๋๋ค.
์, ์ด๋ ๋ฉํธ๋ฆญ apiserver๊ฐ ์คํ๋๊ณ ์์ง ์์์ ์๋ฏธํฉ๋๋ค. ์ฆ, HPA๊ฐ ํด๋ฌ์คํฐ์์ ์๋ํ์ง ์๊ณ ๋ค๋ฅธ ๊ฒ๋ค๋ ์๋ํ์ง ์์์ ์๋ฏธํฉ๋๋ค.
์. HPA๋ ์ง๊ธ ์๋ํ์ง ์์ต๋๋ค. ์ธก์ ํญ๋ชฉ์ ์ญ์ ํ๊ณ ์์ ํ๋ ๋ฐฉ๋ฒ์ ์ฐพ์์๋ ์๋ฉ๋๋ค.
@thyarles ์ ๋ง ๊ฐ์ฌํฉ๋๋ค. ๋๋ ๋น์ ์ ๋ฐฉ์์ผ๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
$ kubectl get apiservices๋ ์ฌ์ฉํ ์์๋ ์๋น์ค๋ฅผ ํ์ธํ๊ณ , ์ฌ์ฉ ๊ฐ๋ฅํ ์๋น์ค๋ฅผ ์ญ์ ํ๋ฉด $ kubectl delete apiservice [service-name]์ ์ํด false๊ฐ๋ฉ๋๋ค. ๊ทธ ํ์๋ ๋ค์ ์คํ์ด์ค ์ญ์ ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ฐ๋ฆฌ ํ์๋ ์ฌ์ฉํ ์์๋ 3 ๊ฐ์ apiservices, v1beta1.admission.certmanager.k8s.io, v1beta1.metrics.k8s.io ๋ฐ v1beta1.webhook.certmanager.k8s.io๊ฐ ์์ต๋๋ค.
@ xzhang007 ๊ธฐ๋ป์! ์ด์ v1beta1.metrics.k8s.io๊ฐ ์์๋ ์ด์ ๋ฅผ ํ์ธํด์ผํฉ๋๋ค. ์ด๋ป๊ฒ๋๋์ง ํ์ธํ์ธ์ :
```
$ kubectl -n kube-system ๋ชจ๋ ๊ฐ์ ธ ์ค๊ธฐ | grep ๋ฉํธ๋ฆญ
pod / metrics-server-64f74f8d47-r5vcq 2/2 ์คํ 9119d
service / metrics-server ClusterIP xx.xx.xx.xx
deployment.apps / metrics-server 1/1 1 1 201d
replicaset.apps / metrics-server-55c7f68d94 0 0 0 165d
replicaset.apps / metrics-server-5c696bb6d7 0 0 0 201d
replicaset.apps / metrics-server-5cdb8bb4fb 00 201d
replicaset.apps / metrics-server-64f74f8d471111119d
replicaset.apps / metrics-server-686789bb4b 000145d''`
$ kubectl -n kube-system ๋ชจ๋ ๊ฐ์ ธ ์ค๊ธฐ | grep ๋ฉํธ๋ฆญ
pod / metrics-server-5dcfd4dd9f-m2v9k 1/1 ์คํ ์ค 0 2d20h
service / metrics-server ClusterIP xx.xx.xx.xx
deployment.apps / metrics-server 1/1 1 1 27d
replicaset.apps / metrics-server-5dcfd4dd9f 11 1 27d
replicaset.apps / metrics-server-7fcf9cc98b 00027d
์. HPA๋ ์ง๊ธ ์๋ํ์ง ์์ต๋๋ค. ์ธก์ ํญ๋ชฉ์ ์ญ์ ํ๊ณ ์์ ํ๋ ๋ฐฉ๋ฒ์ ์ฐพ์์๋ ์๋ฉ๋๋ค.
@ xzhang007 ์ฌ์ค ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌํ๊ธฐ ์ ์๋ ์๋ํ์ง ์์ต๋๋ค .... ์ญ์ ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ๋ฉ์ถค ๋ชจ๋๋ก ์ค์ ํ๊ธฐ ๋๋ฌธ์ ๋ฐฉ๊ธ ์์ ์ฐจ ๋ ธ์ต๋๋ค. helm ํจํค์ง ๊ด๋ฆฌ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ฉํธ๋ฆญ ์๋ฒ๋ฅผ ๋ค์ ๋ฐฐํฌํ๊ฑฐ๋ ๋ค์ ๋ช ๋ น์ ํธ์ถํ์ฌ ์์ ํ์ญ์์ค ( ์ ์ฉํ๊ธฐ ์ ์ ๋ฐฐํฌ ํ์ผ ํ์ธ ).
$ curl https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/metrics-server/metrics-server-deployment.yaml | kubectl apply -f -
@slassh ์๋ฃจ์ ์ Kubernetes 1.15์์ ์ ์๊ฒ
v1beta1.metrics.k8s.io APIService ์ญ์
kubectl get ns ns-to-delete -o yaml
...
status:
conditions:
- lastTransitionTime: "2020-01-08T05:36:52Z"
message: 'Discovery failed for some groups, 1 failing: unable to retrieve the
complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently
unable to handle the request'
...
kubectl get APIService
...
v1beta1.metrics.k8s.io kube-system/metrics-server False (ServiceNotFound)
kubectl delete v1beta1.metrics.k8s.io APIService
์ธ์ฆ์ ๊ด๋ฆฌ์๊ฐ ์๋ชป ์ค์ ๋์๊ธฐ ๋๋ฌธ์ ์ฌ์ฉํ ์ ์์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์์ ์ปจํธ๋กค๋ฌ์์ ์๋ชป๋ ๊ตฌ๋ฌธ์ ์ฌ์ฉํฉ๋๋ค. ์ฐ๋ฆฌ ์์คํ ์ ๊ฒฝ์ฐ
"certmanager.k8s.io/cluster-issuer": "letsencrypt-prod"
๊ทธ๋ฆฌ๊ณ ๊ทธ๊ฒ์
"cert-manager.io/cluster-issuer": "letsencrypt-prod"
์ฌ์ฉํ ์ ์๋๋กํฉ๋๋ค.
์ด ๋ฌธ์ ์์ ์์ kubectl replace --raw
๋ฅผ ์ฌ์ฉํ ์์๋ ์ต์ ๋ฒ์ ์ kubectl์ ์ฌ์ฉํ์ฌ kubectl์ ์ํด ๋
ธ์ถ๋์ง ์์ API๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์คํ์ด์ค๋ฅผ ์ข
๋ฃํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค (์ด๋ค ๋ฒ์ ์ธ์ง ํ์คํ์ง ์์). ์ด๋ ๊ฒํ๋ฉด kubectl proxy
ํ๋ก์ธ์ค๋ฅผ ์์ฑ ํ ํ์๊ฐ์๊ณ curl
์์ ์ข
์์ฑ์ ํผํ ์ ์์ต๋๋ค (busybox์ ๊ฐ์ ์ผ๋ถ ํ๊ฒฝ์์๋ ์ฌ์ฉํ ์ ์์). ์ด๊ฒ์ด ๋ค๋ฅธ ์ฌ๋์ ๋์ธ ์ ์๊ธฐ๋ฅผ ๋ฐ๋ผ๋ฉฐ ๋๋ ์ด๊ฒ์ ์ฌ๊ธฐ์ ๋จ๊ฒผ์ต๋๋ค.
kubectl get namespace "stucked-namespace" -o json \
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
| kubectl replace --raw /api/v1/namespaces/stucked-namespace/finalize -f -
์ด๊ฒ์ด ํด๊ฒฐ ๊ฐ๋ฅํ ๋ฌธ์ ์ธ์ง ์ฌ๋ถ๊ฐ ํ์ธ ๋์์ต๋๊น? ์ฌ๊ธฐ์๋ ๋ง์ ํดํค ์๋ฃจ์
์ด ์์ง๋ง ์ฐ๋ฆฌ ์ค ๋๊ตฌ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ์ ์๋ค๋ ๊ทผ๋ณธ์ ์ธ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ์ ์์ต๋๋ค ....
EKS v1.14 ํด๋ฌ์คํฐ์ ์์ต๋๋ค.
์ด๊ฒ์ด ํด๊ฒฐ ๊ฐ๋ฅํ ๋ฌธ์ ์ธ์ง ์ฌ๋ถ๊ฐ ํ์ธ ๋์์ต๋๊น? ์ฌ๊ธฐ์๋ ๋ง์ ํดํค ์๋ฃจ์ ์ด ์์ง๋ง ์ฐ๋ฆฌ ์ค ๋๊ตฌ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ ์ ์๋ค๋ ๊ทผ๋ณธ์ ์ธ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ์ ์์ต๋๋ค.
๊ทผ๋ณธ์ ์ธ ๋ฌธ์ ๋ ํด๋ฌ์คํฐ์ ์ง๊ณ ๋ API ๊ทธ๋ฃน์ ์ฌ์ฉํ ์ ์๋ค๋ ๊ฒ์ ๋๋ค. ๋ชจ๋ API๋ฅผ ์ฌ์ฉํ ์์์ ๋๊น์ง ๋ค์ ์คํ์ด์ค ์ ๋ฆฌ ์ปจํธ๋กค๋ฌ๊ฐ ์ฐจ๋จ๋์ด ๋ชจ๋ API ๊ทธ๋ฃน์ ๋ชจ๋ ๋ฆฌ์์ค๊ฐ ํด๋น ๋ค์ ์คํ์ด์ค์ ๋ํด ์ ๋ฆฌ๋์๋์ง ํ์ธํ ์ ์์ต๋๋ค.
API๋ฅผ ์ปฌ๋งํ๋ ค๋ ppl์ ๊ฒฝ์ฐ :
# Check all possible clusters, as your .KUBECONFIG may have multiple contexts:
kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
# Select name of cluster you want to interact with from above output:
export CLUSTER_NAME="some_server_name"
# Point to the API server referring the cluster name
APISERVER=$(kubectl config view -o jsonpath="{.clusters[?(@.name==\"$CLUSTER_NAME\")].cluster.server}")
# Gets the token value
TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
# Explore the API with TOKEN
curl -X GET $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#without -kubectl-proxy
๋ค์์์ด ์์
์ ์๋์ผ๋ก ์ํํ๋ ์คํฌ๋ฆฝํธ์
๋๋ค. jq
:
#!/bin/bash
if [ -z "${1}" ] ; then
echo -e "\nUsage: ${0} <name_of_the_namespace_to_remove_the_finalizer_from>\n"
echo "Valid cluster names, based on your kube config:"
kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}'
exit 1
fi
kubectl proxy --port=8901 &
PID=$!
sleep 1
echo -n 'Current context : '
kubectl config current-context
read -p "Are you sure you want to remove the finalizer from namespace ${1}? Press Ctrl+C to abort."
kubectl get namespace "${1}" -o json \
| jq '.spec.finalizers = [ ]' \
| curl -k \
-H "Content-Type: application/json" \
-X PUT --data-binary @- "http://localhost:8901/api/v1/namespaces/${1}/finalize"
kill -15 $PID
๋ชจ๋ : ์ข ๋ฃ ์ ์ ๊ฑฐ๋ฅผ ์๋ํํ๋ ์คํฌ๋ฆฝํธ๋ ์ด์ต๋ณด๋ค ํด๋ฅผ ๋ผ์นฉ๋๋ค . ๊ทธ๋ค์ ์ฌ์ฉํ ์์๋ ์ง๊ณ ๋ apiserver (s)์ ์๊ฐ ํญํ์ ๋จ๊ธธ ์ ์์ต๋๋ค. ๋๊ตฐ๊ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ๋ค์ ๋ง๋ค๋ฉด ๊ฐ์๊ธฐ ์ค๋๋ ๊ฐ์ฒด๊ฐ ๋ค์ ๋ํ๋ ์ ์์ต๋๋ค.
์ค์ ์๋ฃจ์ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
$ kubectl get api-services
# something in the list is unavailable. Figure out what it is and fix it.
# ... the namespace lifecycle controller will finish deleting the namespace.
๋ชจ๋ : ์ข ๋ฃ ์ ์ ๊ฑฐ๋ฅผ ์๋ํํ๋ ์คํฌ๋ฆฝํธ๋ ์ด์ต๋ณด๋ค ํด๋ฅผ ๋ผ์นฉ๋๋ค . ๊ทธ๋ค์ ์ฌ์ฉํ ์์๋ ์ง๊ณ ๋ apiserver (s)์ ์๊ฐ ํญํ์ ๋จ๊ธธ ์ ์์ต๋๋ค. ๋๊ตฐ๊ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ๋ค์ ๋ง๋ค๋ฉด ๊ฐ์๊ธฐ ์ค๋๋ ๊ฐ์ฒด๊ฐ ๋ค์ ๋ํ๋ ์ ์์ต๋๋ค.
์ค์ ์๋ฃจ์ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
$ kubectl get api-services # something in the list is unavailable. Figure out what it is and fix it. # ... the namespace lifecycle controller will finish deleting the namespace.
https://github.com/thyarles/knsk
์ด ์คํฌ๋ฆฝํธ๋ ๋ชจ๋ ๊ฒ์ฌ๋ฅผ ์ํํ๊ณ ๊ณ ์ ๋ฆฌ์์ค ์ฐพ๊ธฐ๋ฅผ ํฌํจํ์ฌ ์์ ํ ์ญ์ ๋ฅผ ์๋ํฉ๋๋ค. ์ฌ์ฉ์๊ฐ ์ํ์ ๊ฐ์ํ๋ ค๋ ๊ฒฝ์ฐ ์คํฌ๋ฆฝํธ๋ ๊ถ์ฅ๋์ง ์๋ ์ญ์ ๋ฐฉ๋ฒ์ ์ํํ๋ --force ์ต์ ์ ์ ๊ณตํฉ๋๋ค.
์คํ, apiservices ์ฌ์ผ ํจ
์ด ๋ช ๋ น์ ์ฌ์ฉํ ์์๋ API๋ฅผ ํ์ํฉ๋๋ค.
kubectl get apiservices --template='{{range $api := .items}}{{range $api.status.conditions}}{{if eq .type "Available"}}{{$api.metadata.name}} {{.status}}{{"\n"}}{{end}}{{end}}{{end}}' | grep -i false
์ด ๊ธฐ์ฌ๋ ํ์คํ ๋น์ ์๊ฒ ์ ์ฉ ํ ๊ฒ์ ๋๋ค.
https://access.redhat.com/solutions/5038511
์ค์ ๋ก ์กด์ฌํ๋ ๊ฒ์ apiservices์ ์ถฉ๋์ด๋ฉฐ openshift์์ API์ ์ํ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
oc get apiservices -o = custom-columns = " name : .metadata.name , status : .status.conditions [0] .status"
์คํจํ api๋ ๋ค์ ์คํ์ด์ค ์ญ์ ๋ฅผ ์๋ํ ํ ํด๋น API์ ์ํ ํฌ๋ ๋๋ ๋ฐฐํฌ๋ฅผ ๋ค์ ์์ํ์ฌ ๋ค์ ์์ํด์ผํฉ๋๋ค.
$ oc namspace ์ญ์
๊ทธ๋ฆฌ๊ณ ์ค๋น, ์ฌ์ ๊ณ ์ !!
๋ชจ๋ ์ฌ๋์ด ์์ด๋ฅผ ์ฌ์ฉํ๋ ๋ฐ ๋์ํ๋ ๊ณณ์์ ์์ ์ ์ธ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๋ฌด๋กํฉ๋๋ค. ๐
๋ชจ๋๊ฐ ์์ด๋ก ๋งํ๋ ๋ฐ ๋์ํ๋ ๊ณณ์ ์ด๋์ ๋๊น?
2020 ๋ 4 ์ 30 ์ผ ๋ชฉ์์ผ 17:58 theAkito [email protected] ์ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
๋ชจ๋๊ฐ ์์ ์ ์ธ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๋ฌด๋กํฉ๋๋ค.
์์ด๋ก ๋งํ๋ ๊ฒ์ ๋์ํฉ๋๋ค. ๐โ
๋๊ธ์ ๋ฌ์ ๊ธฐ ๋๋ฌธ์ ์์ ํ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/kubernetes/kubernetes/issues/60807#issuecomment-622137770 ,
๋๋ ๊ตฌ๋ ์ทจ์
https://github.com/notifications/unsubscribe-auth/ALGMKB6K4OU4X3XOYMALOBLRPHYCDANCNFSM4ETUOEPA
.>
Chris, ์์ ์ํคํ ํธ @ brace.ai
-
๊ธฐ๋ฐ ์ ์ง ๊ณ ์ง :์ด ์ด๋ฉ์ผ์
์๋ ๋ ์์ ์๋ฅผ ํฌํจ ํ ์ ์์ผ๋ฉฐ ๊ธฐ๋ฐ, ๋
์ ๋๋
ํน๊ถ ์ ๋ณด. ๊ทํ๊ฐ ์๋ ๋ ์์ ์๊ฐ ์๋ ๊ฒฝ์ฐ
์ฌ์ฉ, ๊ฒํ , ์ ํฌ, ๋ณต์ฌ ๋๋ ์ทจํด์ง ์กฐ์น๋ฅผ
์ด ๋ฉ์์ง ๋๋ ์ฒจ๋ถ ํ์ผ (์๋ ๊ฒฝ์ฐ)์์ ๊ธ์ง๋ฉ๋๋ค. ๊ทธ๋ ์ง ์๋ค๋ฉด
์ํ๋ ์์ ์์๊ฒ ํ์ ์ด๋ฉ์ผ๋ก ๋ณด๋ธ ์ฌ๋์๊ฒ ์ฐ๋ฝํ์ญ์์ค.
์๋ณธ ๋ฉ์์ง์ ๋ชจ๋ ์ฌ๋ณธ๊ณผ ์ฒจ๋ถ ํ์ผ์ ํ๊ธฐํ๊ฑฐ๋ ์ญ์ ํฉ๋๋ค.
์ค๋น, ์ค๋กํฉ๋๋ค. ์๋ ๋๋ฌธ์ด์์ต๋๋ค. ํด๊ฒฐ๋์์ต๋๋ค.
์ฐ๋ฆฌ๋ ๋ค๊ตญ์ด ์ฌ์ฉ์ ๊ธฐ๋ฐ์ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์ฐ๋ฆฌ์ ๋๊ตฌ ์ค ์ด๋ ๊ฒ๋ ๊ตญ์ ํ๋์ง ์์ ๊ฒ์ ์ถฉ๋ถํ ๋์ฉ๋๋ค. ์ ์ด๋ ์ฌ๊ธฐ github์์ ์น์ ํ ์ ์์ต๋๋ค.
์๋ ํ์ธ์.
์ด ๋ฌธ์ ์์ ์์
kubectl replace --raw
๋ฅผ ์ฌ์ฉํ ์์๋ ์ต์ ๋ฒ์ ์ kubectl์ ์ฌ์ฉํ์ฌ kubectl์ ์ํด ๋ ธ์ถ๋์ง ์์ API๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์คํ์ด์ค๋ฅผ ์ข ๋ฃํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค (์ด๋ค ๋ฒ์ ์ธ์ง ํ์คํ์ง ์์). ์ด๋ ๊ฒํ๋ฉดkubectl proxy
ํ๋ก์ธ์ค๋ฅผ ์์ฑ ํ ํ์๊ฐ์๊ณcurl
์์ ์ข ์์ฑ์ ํผํ ์ ์์ต๋๋ค (busybox์ ๊ฐ์ ์ผ๋ถ ํ๊ฒฝ์์๋ ์ฌ์ฉํ ์ ์์). ์ด๊ฒ์ด ๋ค๋ฅธ ์ฌ๋์ ๋์ธ ์ ์๊ธฐ๋ฅผ ๋ฐ๋ผ๋ฉฐ ๋๋ ์ด๊ฒ์ ์ฌ๊ธฐ์ ๋จ๊ฒผ์ต๋๋ค.kubectl get namespace "stucked-namespace" -o json \ | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \ | kubectl replace --raw /api/v1/namespaces/stucked-namespace/finalize -f -
์ด๊ฒ์ ์๋ฒฝํ๊ฒ ์๋ํ์ต๋๋ค!
์ฐ๋ฆฌ๋ ๋ค๊ตญ์ด ์ฌ์ฉ์ ๊ธฐ๋ฐ์ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์ฐ๋ฆฌ์ ๋๊ตฌ ์ค ์ด๋ ๊ฒ๋ ๊ตญ์ ํ๋์ง ์์ ๊ฒ์ ์ถฉ๋ถํ ๋์ฉ๋๋ค. ์ ์ด๋ ์ฌ๊ธฐ github์์ ์น์ ํ ์ ์์ต๋๋ค.
์ฐ๋ฆฌ๋ ๋ค๊ตญ์ด ์ฌ์ฉ์ ๊ธฐ๋ฐ์ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์ฐ๋ฆฌ์ ๋๊ตฌ ์ค ์ด๋ ๊ฒ๋ ๊ตญ์ ํ๋์ง ์์ ๊ฒ์ ์ถฉ๋ถํ ๋์ฉ๋๋ค. ์ ์ด๋ ์ฌ๊ธฐ github์์ ์น์ ํ ์ ์์ต๋๋ค.
์์ง๋ ์ดํดํ๋ ค๊ณ ํฉ๋๋ค. ์ฉ์ ํด์ค. ์ค์๋ก ์ซ์ด์๋ฅผ ํด๋ฆญํ์ ์ ์์ต๋๋ค.
์, ์ค์ ๋ก ๋๊ตฌ๊ฐ ์๋ฒฝํ๊ฒ ์ํ๋์ง ์์์ต๋๋ค.
์ค๋ช
์์ด ์์ง ์๊ฐ๋ฝ์ ๋ด๋ฆฌ๋ ๊ฒ์ ๋ง์ด๋์ง ์์ต๋๋ค.
๊ฑฐ์ ํญ์์ด ๋ฌธ์ ๋ฅผ ๊ฒฝํํ ๋ CRD์ ๋ฌ๋ ค ์์ต๋๋ค. ํด๋น ๋ค์ ์คํ์ด์ค์์๋ง ์ฌ์ฉ๋๋ ๊ฒฝ์ฐ CRD๋ฅผ ์ญ์ ํ ๋ค์ ์ข ๋ฃ ์ ๋ฐ ๋ค์ ์คํ์ด์ค ์ญ์ ๋ฅผ ์งํํ ์ ์์ต๋๋ค.
์ด ๋ฌธ์ ์์ ์์
kubectl replace --raw
๋ฅผ ์ฌ์ฉํ ์์๋ ์ต์ ๋ฒ์ ์ kubectl์ ์ฌ์ฉํ์ฌ kubectl์ ์ํด ๋ ธ์ถ๋์ง ์์ API๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์คํ์ด์ค๋ฅผ ์ข ๋ฃํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค (์ด๋ค ๋ฒ์ ์ธ์ง ํ์คํ์ง ์์). ์ด๋ ๊ฒํ๋ฉดkubectl proxy
ํ๋ก์ธ์ค๋ฅผ ์์ฑ ํ ํ์๊ฐ์๊ณcurl
์์ ์ข ์์ฑ์ ํผํ ์ ์์ต๋๋ค (busybox์ ๊ฐ์ ์ผ๋ถ ํ๊ฒฝ์์๋ ์ฌ์ฉํ ์ ์์). ์ด๊ฒ์ด ๋ค๋ฅธ ์ฌ๋์ ๋์ธ ์ ์๊ธฐ๋ฅผ ๋ฐ๋ผ๋ฉฐ ๋๋ ์ด๊ฒ์ ์ฌ๊ธฐ์ ๋จ๊ฒผ์ต๋๋ค.kubectl get namespace "stucked-namespace" -o json \ | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \ | kubectl replace --raw /api/v1/namespaces/stucked-namespace/finalize -f -
@teoincontatto ๊ฐ์ฌํฉ๋๋ค! ์ด๊ฒ์ ๋ง์นจ๋ด ์๋ํ์ต๋๋ค!
๋๋ก๋ ๋ฆฌ์์ค ๋งค๋ํ์คํธ๋ฅผ ์จ๋ผ์ธ์ผ๋ก ํธ์งํ๋ ๊ฒ์ด ์ ์๋ํ์ง ์์ ์ ์์ต๋๋ค (์ฆ, finalizers
ํ์ผ์ ์ ๊ฑฐํ๊ณ ์ ์ฅํ์ญ์์ค).
๊ทธ๋์ ๋๋ ๋ค๋ฅธ ์ฌ๋๋ค๋ก๋ถํฐ ์๋ก์ด ๋ฐฉ๋ฒ์ ์ป์์ต๋๋ค.
kubectl get namespace linkerd -o json > linkerd.json
# Where:/api/v1/namespaces/<your_namespace_here>/finalize
kubectl replace --raw "/api/v1/namespaces/linkerd/finalize" -f ./linkerd.json
์ด ๋ช ๋ น์ ์คํ ํ ํ ๋ค์ ์คํ์ด์ค ๋ชฉ๋ก์ ๋ค์ ์คํ์ด์ค๊ฐ ์์ด์ผํฉ๋๋ค.
namespace
๋ฟ๋ง ์๋๋ผ ๋ค๋ฅธ ๋ฆฌ์์ค๋ ์ง์ํฉ๋๋ค.
kubectl edit annoying-ns
์ฌ์ฉํ์ฌ ์ข
๋ฃ ์ ์ค์ ์ ๊ฑฐํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
ํ ... ๋๋ ์ง๊ธ์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค :)
์ค๋ ์ ๋ 1.15์์ 1.16์ผ๋ก eks ํด๋ฌ์คํฐ๋ฅผ ์
๋ฐ์ดํธํ์ต๋๋ค.
์ง๊ธ๊น์ง ๋ชจ๋ ๊ฒ์ด ๊ด์ฐฎ์ ๋ณด์
๋๋ค.
๊ทธ๋ฌ๋ ๋ด ๊ฐ๋ฐ ns "configcluster"๋ ์ผ์ข
์ "์์"์ด์์ต๋๋ค.
๊ทธ๋์ ๋๋ ๊ทธ๊ฒ์ ์ ๋ฆฌํ๊ธฐ๋ก ๊ฒฐ์ ํ์ต๋๋ค.
k ns configcluster ์ญ์
....
์ด์ ์ด๊ฒ์ ์ค๋จ๋ฉ๋๋ค (3h +) : /
$ kubectl get namespace configcluster -o yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"name":"configcluster"}}
creationTimestamp: "2020-06-19T06:40:15Z"
deletionTimestamp: "2020-06-19T09:19:16Z"
name: configcluster
resourceVersion: "22598109"
selfLink: /api/v1/namespaces/configcluster
uid: e50f0b53-b21e-4e6e-8946-c0a0803f031b
spec:
finalizers:
- kubernetes
status:
conditions:
- lastTransitionTime: "2020-06-19T09:19:21Z"
message: 'Discovery failed for some groups, 1 failing: unable to retrieve the
complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently
unable to handle the request'
reason: DiscoveryFailed
status: "True"
type: NamespaceDeletionDiscoveryFailure
- lastTransitionTime: "2020-06-19T09:19:22Z"
message: All legacy kube types successfully parsed
reason: ParsedGroupVersions
status: "False"
type: NamespaceDeletionGroupVersionParsingFailure
- lastTransitionTime: "2020-06-19T09:19:22Z"
message: All content successfully deleted
reason: ContentDeleted
status: "False"
type: NamespaceDeletionContentFailure
phase: Terminating
๋ฐ ๋ฌธ์ ์์์ด ๊ฐ์์ ๋ ๋ง์ด ๋ ธ์ถ๋๋ ๋ฐฉ๋ฒ์ ๋ฌด์์ ๋๊น?
2020 ๋
6 ์ 19 ์ผ ๊ธ์์ผ ์ค์ 4:46 Andreas Hรถhmann [email protected]
์ผ๋ค :
ํ ... ๋๋ ์ง๊ธ์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค :)
์ค๋ ์ ๋ 1.15์์ 1.16์ผ๋ก eks ํด๋ฌ์คํฐ๋ฅผ ์ ๋ฐ์ดํธํ์ต๋๋ค.
์ง๊ธ๊น์ง ๋ชจ๋ ๊ฒ์ด ๊ด์ฐฎ์ ๋ณด์ ๋๋ค.
๊ทธ๋ฌ๋ ๋ด ๊ฐ๋ฐ ns "configcluster"๋ ์ผ์ข ์ "์์"์ด์์ต๋๋ค.
๊ทธ๋์ ๋๋ ๊ทธ๊ฒ์ ์ ๋ฆฌํ๊ธฐ๋ก ๊ฒฐ์ ํ์ต๋๋ค.k ns configcluster ์ญ์
....
์ด์ ์ด๊ฒ์ ์ค๋จ๋ฉ๋๋ค (3h +) : /$ kubectl get namespace configcluster -o yaml
apiVersion : v1
์ข ๋ฅ : ๋ค์ ์คํ์ด์ค
๋ฉํ ๋ฐ์ดํฐ :
์ฃผ์ :
kubectl.kubernetes.io/last-applied-configuration : |
{ "apiVersion": "v1", "kind": "Namespace", "metadata": { "annotations": {}, "name": "configcluster"}}
creationTimestamp : "2020-06-19T06 : 40 : 15Z"
deleteTimestamp : "2020-06-19T09 : 19 : 16Z"
์ด๋ฆ : configcluster
resourceVersion : "22598109"
selfLink : / api / v1 / namespaces / configcluster
uid : e50f0b53-b21e-4e6e-8946-c0a0803f031b
ํฌ๊ธฐ:
์ข ๋ฃ ์ :
- Kubernetes
์ํ:
์ ํฉ:- lastTransitionTime : "2020-06-19T09 : 19 : 21Z"
๋ฉ์์ง : '์ผ๋ถ ๊ทธ๋ฃน์ ๋ํ ๊ฒ์ ์คํจ, 1 ๊ฐ ์คํจ : ๊ฒ์ ํ ์ ์์
์๋ฒ API์ ์ ์ฒด ๋ชฉ๋ก : metrics.k8s.io/v1beta1 : ์๋ฒ๋ ํ์ฌ
์์ฒญ์ ์ฒ๋ฆฌ ํ ์ โโ์์ต๋๋ค. '
์ด์ : DiscoveryFailed
์ํ : "์ฐธ"
์ ํ : NamespaceDeletionDiscoveryFailure- lastTransitionTime : "2020-06-19T09 : 19 : 22Z"
๋ฉ์์ง : ๋ชจ๋ ๋ ๊ฑฐ์ kube ์ ํ์ด ์ฑ๊ณต์ ์ผ๋ก ํ์ฑ๋์์ต๋๋ค.
์ด์ : ParsedGroupVersions
์ํ : "False"
์ ํ : NamespaceDeletionGroupVersionParsingFailure- lastTransitionTime : "2020-06-19T09 : 19 : 22Z"
๋ฉ์์ง : ๋ชจ๋ ์ฝํ ์ธ ๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์ญ์ ๋์์ต๋๋ค.
์ด์ : ContentDeleted
์ํ : "False"
์ ํ : NamespaceDeletionContentFailure
๋จ๊ณ : ์ข ๋ฃโ
๋๊ธ์ ๋ฌ์ ๊ธฐ ๋๋ฌธ์ ์์ ํ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/kubernetes/kubernetes/issues/60807#issuecomment-646543073 ,
๋๋ ๊ตฌ๋ ์ทจ์
https://github.com/notifications/unsubscribe-auth/AFLKRCLHIZ77X2Z3F5GAOCTRXMXVTANCNFSM4ETUOEPA
.
@bobhenkel ์์ด ๋ฌธ์ ๋ ์ข ๊ฒฐ๋์์ผ๋ฏ๋ก ์ค์ ๋ก ์ด๊ฒ์ ๋ฌธ์ ๊ฐ ์์์ ์๋ฏธํฉ๋๋ค (์คํ ๊ฐ๋ฅํ ํญ๋ชฉ์ ๊ดํ ํ). ์ ์ฌํ ์ํฉ์ ์ฒ๋ฆฌํ๋ ๋ฐ ์ค์ง์ ์ธ ๋์์ด ํ์ํ ๊ฒฝ์ฐ ์์ ์ค๋ ๋๋ฅผ ์ฝ์ผ์ญ์์ค. ๊ฑฐ๊ธฐ์ ์ข์ ์กฐ์ธ (๋ฐ ์ผ๋ถ ๋์ ์กฐ์ธ)์ด ์์ต๋๋ค.
์ ๊ฒฝ์ฐ์๋ GCP ๋คํธ์ํฌ ์๋น์ค ์ฝ์์์ ์ธ ๊ทธ๋ ์ค ๋ถํ ๋ถ์ฐ๊ธฐ๋ฅผ ์๋์ผ๋ก ์ญ์ ํด์ผํ์ต๋๋ค. ์ฝ์์์ ์ง์ ๋ก๋ ๋ฐธ๋ฐ์ ํ๋ฐํธ ์๋๋ฅผ ์๋์ผ๋ก ์์ฑํ์ต๋๋ค. ๋ก๋ ๋ฐธ๋ฐ์๋ฅผ ์ญ์ ํ๋ฉด ๋ค์ ์คํ์ด์ค๊ฐ ์๋์ผ๋ก ์ญ์ ๋์์ต๋๋ค.
๋ก๋ ๋ฐธ๋ฐ์์ ์ํ๊ฐ ๋งค๋ํ์คํธ์ ์ํ์ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ Kubernetes๊ฐ ์ญ์ ๋ฅผ ์ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋์ง ํ์ธํ๊ธฐ ์ํด ๋ค์ ์ฃผ์์ ์ฌ์ฉํ์ฌ ์์ ํ๋ฐํธ ์๋ ์์ฑ์ ์๋ํํ๋ ค๊ณ ํฉ๋๋ค.
๋๋ก๋ ๋ฆฌ์์ค ๋งค๋ํ์คํธ๋ฅผ ์จ๋ผ์ธ์ผ๋ก ํธ์งํ๋ ๊ฒ์ด ์ ์๋ํ์ง ์์ ์ ์์ต๋๋ค (์ฆ,
finalizers
ํ์ผ์ ์ ๊ฑฐํ๊ณ ์ ์ฅํ์ญ์์ค).
๊ทธ๋์ ๋๋ ๋ค๋ฅธ ์ฌ๋๋ค๋ก๋ถํฐ ์๋ก์ด ๋ฐฉ๋ฒ์ ์ป์์ต๋๋ค.kubectl get namespace linkerd -o json > linkerd.json # Where:/api/v1/namespaces/<your_namespace_here>/finalize kubectl replace --raw "/api/v1/namespaces/linkerd/finalize" -f ./linkerd.json
์ด ๋ช ๋ น์ ์คํ ํ ํ ๋ค์ ์คํ์ด์ค ๋ชฉ๋ก์ ๋ค์ ์คํ์ด์ค๊ฐ ์์ด์ผํฉ๋๋ค.
namespace
๋ฟ๋ง ์๋๋ผ ๋ค๋ฅธ ๋ฆฌ์์ค๋ ์ง์ํฉ๋๋ค.
๋น์ ์ ๊ทธ๊ฒ์ด ์ผํ ์คํ์ ๋๋ค
๋๋ก๋ ๋ฆฌ์์ค ๋งค๋ํ์คํธ๋ฅผ ์จ๋ผ์ธ์ผ๋ก ํธ์งํ๋ ๊ฒ์ด ์ ์๋ํ์ง ์์ ์ ์์ต๋๋ค (์ฆ,
finalizers
ํ์ผ์ ์ ๊ฑฐํ๊ณ ์ ์ฅํ์ญ์์ค).
๊ทธ๋์ ๋๋ ๋ค๋ฅธ ์ฌ๋๋ค๋ก๋ถํฐ ์๋ก์ด ๋ฐฉ๋ฒ์ ์ป์์ต๋๋ค.kubectl get namespace linkerd -o json > linkerd.json # Where:/api/v1/namespaces/<your_namespace_here>/finalize kubectl replace --raw "/api/v1/namespaces/linkerd/finalize" -f ./linkerd.json
์ด ๋ช ๋ น์ ์คํ ํ ํ ๋ค์ ์คํ์ด์ค ๋ชฉ๋ก์ ๋ค์ ์คํ์ด์ค๊ฐ ์์ด์ผํฉ๋๋ค.
namespace
๋ฟ๋ง ์๋๋ผ ๋ค๋ฅธ ๋ฆฌ์์ค๋ ์ง์ํฉ๋๋ค.
๋ง์ ์๋ฃจ์ ์ ์๋ํ์ง๋ง ์ด๊ฒ์ ๋๋ฅผ ์ํด ์ผํ ๊ฒ์ ๋๋ค. ๊ฐ์ฌํฉ๋๋ค!
curl -k -H "Content-Type : application / json"-X PUT --data-binary @ tmp.json https : // kubernetes-cluster-ip / api / v1 / namespaces / annoying-namespace-to-delete / ๋ง๋ฌด๋ฆฌํ๋ค
๋ ๋์ https://stackoverflow.com/a/59667608/429476
์ด๊ฒ์ ์ ๋ง๋ก "ํ์ฉ๋๋"๋๋ต์ด์ด์ผํฉ๋๋ค .์ด ๋ฌธ์ ์ ๊ทผ์ ์ด ์์ ํ ํด๊ฒฐ๋์์ต๋๋ค!
์์ ๋งํฌ์์ ๊ฐ์ ธ์ต๋๋ค.
์ด๊ฒ์ ํนํ ํ๋ก๋์ ํ๊ฒฝ์์ ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ด ์๋๋๋ค.
์ค๋ ๋๋ ๊ฐ์ ๋ฌธ์ ์ ๋ค์ด๊ฐ๋ค. ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ๋ฉด ๋ค์ํ ์ํ์์ ๋จ์ ์์์ด ๋จ๊ฒ๋ฉ๋๋ค. ์ค์ ๋ก ์ญ์ ๋ฅผ ์์ ํ๊ฒ ์ ์งํ๋ ๊ฒ์ด ๋ฌด์์ธ์ง ์ฐพ์์ผํฉ๋๋ค.
https://github.com/kubernetes/kubernetes/issues/60807#issuecomment -524772920์ ์ฐธ์กฐ
(๋ํ ๋ถํํ๋ 'kubetctl get all'์ ๋ชจ๋ ๊ฒ์๋ณด๊ณ ํ์ง ์์ต๋๋ค. ๋งํฌ์์์ ๊ฐ์ ์ ์ฌํ ๋ช ๋ น์ ์ฌ์ฉํด์ผํฉ๋๋ค.)
๋ด ์ฌ๋ก- 'cert-manager'๋ค์ ์คํ์ด์ค ์ญ์ . 'kubectl get apiservice -o yaml'์ ์ถ๋ ฅ์์ โโstatus = False ์ธ APIService 'v1beta1.admission.certmanager.k8s.io'๋ฅผ ์ฐพ์์ต๋๋ค. ์ด apiservice๋ ๋ฐฉ๊ธ ์ญ์ ํ cert-manager์ ์ผ๋ถ์์ต๋๋ค. ๋ฐ๋ผ์ 'kubectl delete apiservice v1beta1.admission.certmanager.k8s.io'ํ 10 ์ด ๋ง์ ๋ค์ ์คํ์ด์ค๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
๋์์ด๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
์ฆ, Terminating ๋ค์ ์คํ์ด์ค๋ฅผ ์๋์ผ๋ก ์ญ์ ํ๋ ๋งค์๊ฐ CronJob์ผ๋ก ์คํ๋๋ ์์ ๋ง์ดํฌ๋ก ์๋น์ค๋ฅผ ์์ฑํ์ต๋๋ค.
์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ต๋๋ค : https://github.com/oze4/service.remove-terminating-namespaces
์ ๋ Terminating ๋ค์ ์คํ์ด์ค๋ฅผ ์๋์ผ๋ก ์ญ์ ํ๋ ๋งค์๊ฐ CronJob์ผ๋ก ์คํ๋๋ ์์ ๋ง์ดํฌ๋ก ์๋น์ค๋ฅผ ์์ฑํ์ต๋๋ค.
์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ต๋๋ค : https://github.com/oze4/service.remove-terminating-namespaces
๋ ๋ค๋ฅธ oneliner :
for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl get ns $ns -ojson | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -; done
๊ทธ๋ฌ๋ ๊ณ ์ ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ๋ ๊ฒ์ ์ข์ ํด๊ฒฐ์ฑ
์ด ์๋๋๋ค. ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ ์ ๋ถ์ด ์๋์ง ์์๋ด๋ ๊ฒ์
๋๋ค. ๋งค์ฐ ์ผ๋ฐ์ ์ธ ์ด์ ๋ ์ฌ์ฉํ ์์๋ API ์๋น์ค๊ฐ์์ด ํด๋ฌ์คํฐ๊ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ์๋ฃํ์ง ๋ชปํ๋๋กํ๊ธฐ ๋๋ฌธ์
๋๋ค.
์๋ฅผ ๋ค์ด ์ฌ๊ธฐ์์๋ Knative๋ฅผ ์ ๋๋ก ์ญ์ ํ์ง ์์์ต๋๋ค.
$ kubectl get apiservice|grep False
NAME SERVICE AVAILABLE AGE
v1beta1.custom.metrics.k8s.io knative-serving/autoscaler False (ServiceNotFound) 278d
๊ทธ๊ฒ์ ์ญ์ ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
k delete apiservice v1beta1.custom.metrics.k8s.io
apiservice.apiregistration.k8s.io "v1beta1.custom.metrics.k8s.io" deleted
$ k create ns test2
namespace/test2 created
$ k delete ns test2
namespace "test2" deleted
$ kgns test2
Error from server (NotFound): namespaces "test2" not found
์ ๋ Terminating ๋ค์ ์คํ์ด์ค๋ฅผ ์๋์ผ๋ก ์ญ์ ํ๋ ๋งค์๊ฐ CronJob์ผ๋ก ์คํ๋๋ ์์ ๋ง์ดํฌ๋ก ์๋น์ค๋ฅผ ์์ฑํ์ต๋๋ค.
์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ต๋๋ค : https://github.com/oze4/service.remove-terminating-namespaces
์ ํ์ด.
๋๋ ๋ฉ k8s ํด๋ฌ์คํฐ์ 1.18์์ ๋น์ทํ ๋ฌธ์ ๊ฐ ์์๊ณ ๋ค๋ฅธ ์ฌ๋๋ค์ ๋๊ธฐ ์ํด ๋ฉ๋ชจ๋ฅผ ์ถ๊ฐํ์ต๋๋ค. ์ ๋ ๋ฉํธ๋ฆญ API์ ํนํ ์ฌ์ฉ์ ์ง์ ๋ฉํธ๋ฆญ์ผ๋ก ์์ ํ์ต๋๋ค. ๋ค์ ์์ฑํ๊ธฐ ์ํด ํด๋น k8s ๊ฐ์ฒด๋ฅผ ์ญ์ ํ ํ ๋ฉํธ๋ฆญ API ์๋ ํฌ์ธํธ๋ฅผ ์ฐพ์ ์ ์๋ค๋ ์ค๋ฅ์ ํจ๊ป ๋ค์ ์คํ์ด์ค ์ญ์ ๊ฐ ์ค๋จ๋์์ต๋๋ค. ๋ค์ ๋ค๋ฅธ ์ด๋ฆ ๊ณต๊ฐ์ ๋ฃ์ผ๋ฉด ๋ชจ๋ ๊ฒ์ด ์ฆ์ ์ ๋ฆฌ๋์์ต๋๋ค.
์ด๊ฒ์ status.conditions.message ์๋์ ๋ค์ ์คํ์ด์ค์์์์ต๋๋ค.
Discovery failed for some groups, 4 failing: unable to retrieve the
complete list of server APIs: custom.metrics.k8s.io/v1beta1: the server is currently
unable to handle the request, custom.metrics.k8s.io/v1beta2: the server is currently
unable to handle the request, external.metrics.k8s.io/v1beta1: the server is
currently unable to handle the request, metrics.k8s.io/v1beta1: the server is
๋ ๋ค๋ฅธ oneliner :
for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl get ns $ns -ojson | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -; done
๊ทธ๋ฌ๋ ๊ณ ์ ๋ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ๋ ๊ฒ์ ์ข์ ํด๊ฒฐ์ฑ ์ด ์๋๋๋ค. ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ ์ ๋ถ์ด ์๋์ง ์์๋ด๋ ๊ฒ์ ๋๋ค. ๋งค์ฐ ์ผ๋ฐ์ ์ธ ์ด์ ๋ ์ฌ์ฉํ ์์๋ API ์๋น์ค๊ฐ์์ด ํด๋ฌ์คํฐ๊ฐ ๋ค์ ์คํ์ด์ค๋ฅผ ์๋ฃํ์ง ๋ชปํ๋๋กํ๊ธฐ ๋๋ฌธ์ ๋๋ค.
์๋ฅผ ๋ค์ด ์ฌ๊ธฐ์์๋ Knative๋ฅผ ์ ๋๋ก ์ญ์ ํ์ง ์์์ต๋๋ค.$ kubectl get apiservice|grep False NAME SERVICE AVAILABLE AGE v1beta1.custom.metrics.k8s.io knative-serving/autoscaler False (ServiceNotFound) 278d
๊ทธ๊ฒ์ ์ญ์ ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
k delete apiservice v1beta1.custom.metrics.k8s.io apiservice.apiregistration.k8s.io "v1beta1.custom.metrics.k8s.io" deleted
$ k create ns test2 namespace/test2 created $ k delete ns test2 namespace "test2" deleted $ kgns test2 Error from server (NotFound): namespaces "test2" not found
ํ์คํ ๊ฐ์ฅ ๊นจ๋ํ ๋ผ์ด๋! ์ด๋ฌํ "์๋ฃจ์ "์ค ์ด๋ ๊ฒ๋ ์ค์ ๋ก ๊ทผ๋ณธ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง ๋ชปํ๋ค๋ ์ ์ ์ ์ํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค.
๊ทธ๊ฒ์ ๋ฉ์์ง๊ฐ ํผ์ ธ ์ผ ํ ๊ฒ์ ๋๋ค. : smile : "์์ง ๋ค๋ฅธ ํ๋์ ๋ผ์ด๋"๊ฐ ์๋๋๋ค.
ํ์คํ ๊ฐ์ฅ ๊นจ๋ํ ํ ๋ผ์ด๋! ์ด๋ฌํ "์๋ฃจ์ "์ค ์ด๋ ๊ฒ๋ ์ค์ ๋ก ๊ทผ๋ณธ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง ๋ชปํ๋ค๋ ์ ์ ์ ์ํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค.
์ด ์๋ฃจ์ ์ ๋ชจ๋ ๊ฐ๋ฅ์ฑ ์ค ํ๋๋ฅผ ํด๊ฒฐํฉ๋๋ค. ๊ฐ๋ฅํ ๋ชจ๋ ๊ทผ๋ณธ ์์ธ์ ์ฐพ์ ์์ ํ๋ ค๋ฉด ๋ค์ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํฉ๋๋ค. https://github.com/thyarles/knsk
@thyarles ์์ฃผ ์ข์!
modify finalize
๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํ์ง ๋ง์ญ์์ค. ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
๋ค์ ์คํ์ด์ค๊ฐ ์ข ๋ฃ๋๋ ์์ธ์ ์ฐพ์ผ์ญ์์ค. ํ์ฌ ์๋ ค์ง ๋ฌธ์ ํด๊ฒฐ ๋ฐฉ๋ฒ
๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
# sudo kubectl get ns
NAME STATUS AGE
cattle-global-data Terminating 8d
cattle-global-nt Terminating 8d
cattle-system Terminating 8d
cert-manager Active 8d
default Active 10d
ingress-nginx Terminating 9d
kube-node-lease Active 10d
kube-public Active 10d
kube-system Active 10d
kubernetes-dashboard Terminating 4d6h
local Active 8d
p-2sfgk Active 8d
p-5kdx9 Active 8d
# sudo kubectl get all -n kubernetes-dashboard
No resources found in kubernetes-dashboard namespace.
# sudo kubectl get namespace kubernetes-dashboard -o json
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"annotations": {
"cattle.io/status": "{\"Conditions\":[{\"Type\":\"ResourceQuotaInit\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-09-29T01:15:46Z\"},{\"Type\":\"InitialRolesPopulated\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-09-29T01:15:46Z\"}]}",
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"kubernetes-dashboard\"}}\n",
"lifecycle.cattle.io/create.namespace-auth": "true"
},
"creationTimestamp": "2020-09-29T01:15:45Z",
"deletionGracePeriodSeconds": 0,
"deletionTimestamp": "2020-10-02T07:59:52Z",
"finalizers": [
"controller.cattle.io/namespace-auth"
],
"managedFields": [
{
"apiVersion": "v1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
"f:cattle.io/status": {},
"f:lifecycle.cattle.io/create.namespace-auth": {}
},
"f:finalizers": {
".": {},
"v:\"controller.cattle.io/namespace-auth\"": {}
}
}
},
"manager": "Go-http-client",
"operation": "Update",
"time": "2020-09-29T01:15:45Z"
},
{
"apiVersion": "v1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:kubectl.kubernetes.io/last-applied-configuration": {}
}
}
},
"manager": "kubectl-client-side-apply",
"operation": "Update",
"time": "2020-09-29T01:15:45Z"
},
{
"apiVersion": "v1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:status": {
"f:phase": {}
}
},
"manager": "kube-controller-manager",
"operation": "Update",
"time": "2020-10-02T08:13:49Z"
}
],
"name": "kubernetes-dashboard",
"resourceVersion": "3662184",
"selfLink": "/api/v1/namespaces/kubernetes-dashboard",
"uid": "f1944b81-038b-48c2-869d-5cae30864eaa"
},
"spec": {},
"status": {
"conditions": [
{
"lastTransitionTime": "2020-10-02T08:13:49Z",
"message": "All resources successfully discovered",
"reason": "ResourcesDiscovered",
"status": "False",
"type": "NamespaceDeletionDiscoveryFailure"
},
{
"lastTransitionTime": "2020-10-02T08:11:49Z",
"message": "All legacy kube types successfully parsed",
"reason": "ParsedGroupVersions",
"status": "False",
"type": "NamespaceDeletionGroupVersionParsingFailure"
},
{
"lastTransitionTime": "2020-10-02T08:11:49Z",
"message": "All content successfully deleted, may be waiting on finalization",
"reason": "ContentDeleted",
"status": "False",
"type": "NamespaceDeletionContentFailure"
},
{
"lastTransitionTime": "2020-10-02T08:11:49Z",
"message": "All content successfully removed",
"reason": "ContentRemoved",
"status": "False",
"type": "NamespaceContentRemaining"
},
{
"lastTransitionTime": "2020-10-02T08:11:49Z",
"message": "All content-preserving finalizers finished",
"reason": "ContentHasNoFinalizers",
"status": "False",
"type": "NamespaceFinalizersRemaining"
}
],
"phase": "Terminating"
}
# sudo kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:41:02Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:32:58Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
etcdctl
๋ฅผ ์ฌ์ฉํ์ฌ ์ญ์ ๋์ง ์์ ๋ฆฌ์์ค๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/peer.crt \
--key=/etc/kubernetes/pki/etcd/peer.key \
get /registry --prefix | grep <namespace>
ํฐ๋ฏธ๋์ ๋ณต์ฌํ์ฌ ๋ถ์ฌ ๋ฃ๊ธฐ ๋งํ๋ฉด๋ฉ๋๋ค.
for NS in $(kubectl get ns 2>/dev/null | grep Terminating | cut -f1 -d ' '); do
kubectl get ns $NS -o json > /tmp/$NS.json
sed -i '' "s/\"kubernetes\"//g" /tmp/$NS.json
kubectl replace --raw "/api/v1/namespaces/$NS/finalize" -f /tmp/$NS.json
done
/tmp/$NS.json
์ด๊ฒ์ ๋๋ฅผ ์ํด ์ผํ์ผ๋ฉฐ ns์ ๋งค๋ฌ๋ ค์๋ k8s ๊ฐ์ฒด๊ฐ ์๋์ง ํ์ธํ ํ ์คํํ์ต๋๋ค. ๊ฐ์ฌ!
Terminated์์ ๋ฉ์ถ ๋ค์ ์คํ์ด์ค๋ฅผ ์ ๊ฑฐํ๊ธฐ ์ํด ์ด๊ฒ์ ์ฌ์ฉํ์ต๋๋ค.
์ :
kubectl get namespace openebs -o json | jq -j '.spec.finalizers=null' > tmp.json
kubectl replace --raw "/api/v1/namespaces/openebs/finalize" -f ./tmp.json
Terminating on Rancher ํน์ ๋ค์ ์คํ์ด์ค (์ : ๊ฐ์ถ ์์คํ )์์ ๊ฐํ ๋ค์ ์คํ์ด์ค์ ๋ถ๋ชํ ๋ชจ๋ Google ์ง์์๊ฒ ๋ค์ ์์ ๋ ๋ช ๋ น (grebois์ ์๋ณธ)์ด ์ ์๊ฒ ํจ๊ณผ์ ์ด์์ต๋๋ค.
for NS in $(kubectl get ns 2>/dev/null | grep Terminating | cut -f1 -d ' '); do
kubectl get ns $NS -o json > /tmp/$NS.json
sed -i "s/\"controller.cattle.io\/namespace-auth\"//g" /tmp/$NS.json
kubectl replace --raw "/api/v1/namespaces/$NS/finalize" -f /tmp/$NS.json
done
์ฌ๋ฌ๋ถ, ์ฐธ๊ณ ๋ก,์ด kubecon ํ ํฌ ์ ๋น๋์ค๊ฐ ๋์์ ๋ ๋๋ ๊ทธ๊ฒ๊ณผ ์์ ์ ์ฉํ ๋๊ธ ์ค ์ผ๋ถ๋ฅผ ๋งํฌํ๊ณ ์ด ๋ฌธ์ ๋ฅผ ์ ๊ธ ๊ณํ์ ๋๋ค.
๋๋ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง์ ๋ํ 10 ๋ถ๊ฐ์ ์ค๋ช ์ ๋ น์ ํ๊ณ ์ด SIG Deep Dive ์ธ์ ์์ ๋ฐํํ์ต๋๋ค.
์ฌ๊ธฐ ์ 65 ๊ฐ์ ์ฐฌ์ฑ ์ผ๋ก
์์์ ์ฌ๋ฌ ๋ฒ ์ธ๊ธ ๋์ด ์ค๊ฐ ๊ฒ์๋ฌผ ์ ์ฌ๋ฐ๋ฅธ ๋ฐฉ์์ผ๋ก ์์ ์ ์ํํ๋ ์์ ๋๋ค. ๊นจ์ง API ์๋น์ค๋ฅผ ์ฐพ์ ์์ ํฉ๋๋ค.
๋ค์ ์คํ์ด์ค์์ ์ข ๋ฃ์๋ฅผ ์ ๊ฑฐํ๋ ๋ชจ๋ ๋ผ์ด๋ ๋ ๊ทผ๋ณธ ์์ธ์ ํด๊ฒฐํ๊ณ ํด๋ฌ์คํฐ๋ฅผ ๋ฏธ๋ฌํ๊ฒ ๊นจ๋จ๋ ค ๋์ค์ ๋ฌผ๋ฆด ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ ๋ฐ ๊ทธ๋ฌ์ง ๋ง์ธ์. ๊ทผ๋ณธ ์์ธ ์์ ์ ์ผ๋ฐ์ ์ผ๋ก ๋ ์ฝ์ต๋๋ค. ์ด๋ฏธ ์ค๋ ๋์ ๋ง์ ์ ๋ต์ด ์์ง๋ง ์ฌ๋๋ค์ด์ด ํ ๋ง์ ๋ํ ๋ณํ์ ๊ฒ์ํ๋ ๊ฒ์ ์ข์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋ฐ๋ผ์์ด ๋๊ธ์ด ๋งจ ์๋์ ๋จธ๋ฌผ๋๋กํ๊ธฐ ์ํด ์ง๊ธ ๋ฌธ์ ๋ฅผ ์ ๊ธ ๊ฒ์ ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@ManifoldFR , ๋๋ ๋น์ ๊ณผ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ json ํ์ผ๋ก API ํธ์ถ์ ๋ง๋ค์ด ์๋ํ๋๋ก ๊ด๋ฆฌํ์ต๋๋ค.
kubectl get namespace annoying-namespace-to-delete -o json > tmp.json
๊ทธ๋ฐ ๋ค์ tmp.json์ ํธ์งํ๊ณ
"kubernetes"
์ ๊ฑฐํ์ญ์์ค.curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json https://kubernetes-cluster-ip/api/v1/namespaces/annoying-namespace-to-delete/finalize
๋ค์ ์คํ์ด์ค๋ฅผ ์ญ์ ํด์ผํฉ๋๋ค.