kubernetes中如何删除secrets和configmap

avatar 2022年8月8日18:11:20 评论 692 次浏览

在kubernetes中如何删除secrets,在这里我直接使用delete删除,没有报错,但是也没有删除,secrets还一直保留着呢?看了一下信息,删除方法有问题,先看一下我的删除提示信息:

[wolf@wulaoer.org 🔥🔥🔥🔥 ]# kubectl get secrets -n zadig
NAME                              TYPE                                  DATA   AGE
certgen-token-j9v2j               kubernetes.io/service-account-token   3      3m1s
default-token-687xn               kubernetes.io/service-account-token   3      3m1s
discovery-token-tfp9w             kubernetes.io/service-account-token   3      3m1s
gateway-proxy-token-rkhz2         kubernetes.io/service-account-token   3      3m1s
gateway-token-wbmqf               kubernetes.io/service-account-token   3      3m1s
gloo-token-q6fhl                  kubernetes.io/service-account-token   3      6m57s
reach-ssl                         kubernetes.io/tls                     2      7d1h
sa-zadig-zadig-token-gvbq6        kubernetes.io/service-account-token   3      6m57s
zadig-ingress-nginx-token-459pf   kubernetes.io/service-account-token   3      6m57s
zadig-minio-token-klsst           kubernetes.io/service-account-token   3      3m1s
zadig-mongodb-token-nv2b4         kubernetes.io/service-account-token   3      3m1s
zadig-mysql-token-bw4w4           kubernetes.io/service-account-token   3      3m1s
zadig-zadig-dex-token-4gg46       kubernetes.io/service-account-token   3      3m1s
[wolf@wulaoer.org 🔥🔥🔥🔥 ]# kubectl describe secrets -n zadig certgen-token-j9v2j
Name:         certgen-token-j9v2j
Namespace:    zadig
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: certgen
              kubernetes.io/service-account.uid: 9663891d-118d-4579-9ab6-c26f37120325

Type:  kubernetes.io/service-account-token

Data
====
ca.crt:     1180 bytes
namespace:  5 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6Im9IeDh2UmlsVHhqT01zN2RNS3FRTUVHZ3lGekNaNVRlZ1huckJmWkIydjAifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJ6YWRpZyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJjZXJ0Z2VuLXRva2VuLWo5djJqIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImNlcnRnZW4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5NjYzODkxZC0xMThkLTQ1NzktOWFiNi1jMjZmMzcxMjAzMjUiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6emFkaWc6Y2VydGdlbiJ9.MMSE60Fcyx2q6i-L-fk145AOFiJSMYUJ_WBwv4n9XIn6xAQrubckm2tttP-2Gim3Z39IWXfPt3_OHT0detupHUdoxYGlcrCXFUwYaj9WNAJ8iOIKqCAA3_5mx0ww8BCwPXaqSe-uaNGKHl5gl2kY9z-uFK5jUeujKSx1I6CE_0CXeY-10lJdSW3dCV6gbjfxuTEzT6YY7ydqasDnOEIavlk8sOdQ-cAV6JGQScawwuPmHJfx1FQcOzH0Aqw9KTARzmmQgEn0M3Dk5yZ1WZckHOZoF7mGV7PGn1MtrXr5Zb7HbwpfwwnrWwleq1WLGZVo2WhjdwlN-XrZFlCiUpQJ1A

这里的提示中没有有用的信息,应该是删除的方式不对,换个方式试一下。

[wolf@wulaoer.org 🔥🔥🔥🔥 ]# kubectl get secrets -n zadig
NAME                              TYPE                                  DATA   AGE
certgen-token-j9v2j               kubernetes.io/service-account-token   3      3m16s
default-token-687xn               kubernetes.io/service-account-token   3      3m16s
discovery-token-tfp9w             kubernetes.io/service-account-token   3      3m16s
gateway-proxy-token-rkhz2         kubernetes.io/service-account-token   3      3m16s
gateway-token-wbmqf               kubernetes.io/service-account-token   3      3m16s
gloo-token-q6fhl                  kubernetes.io/service-account-token   3      7m12s
reach-ssl                         kubernetes.io/tls                     2      7d1h
sa-zadig-zadig-token-gvbq6        kubernetes.io/service-account-token   3      7m12s
zadig-ingress-nginx-token-459pf   kubernetes.io/service-account-token   3      7m12s
zadig-minio-token-klsst           kubernetes.io/service-account-token   3      3m16s
zadig-mongodb-token-nv2b4         kubernetes.io/service-account-token   3      3m16s
zadig-mysql-token-bw4w4           kubernetes.io/service-account-token   3      3m16s
zadig-zadig-dex-token-4gg46       kubernetes.io/service-account-token   3      3m16s
[wolf@wulaoer.org 🔥🔥🔥🔥 ]# kubectl get sa -n zadig
NAME                  SECRETS   AGE
certgen               1         7d2h
default               1         7d2h
discovery             1         7d2h
gateway               1         7d2h
gateway-proxy         1         7d2h
gloo                  1         7d2h
sa-zadig-zadig        1         7d2h
zadig-ingress-nginx   1         7d2h
zadig-minio           2         7d2h
zadig-mongodb         2         7d2h
zadig-mysql           2         7d2h
zadig-zadig-dex       1         7d2h
[wolf@wulaoer.org 🔥🔥🔥🔥 ]# kubectl delete serviceaccounts -n zadig certgen
serviceaccount "certgen" deleted

这里是删除字典(secrets),但是删除configmap也是一样的,

[wolf@wulaoer.org 🔥🔥🔥🔥 ]# kubectl delete configmaps

以上就是对于secrets和configmap的删除方法,没有了,看些其他的吧。。。。。。

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: