kubernetes helm, jenkins lost token

1/14/2020

I'v had jenkins deployment from helm charts, did by colleague a month ago. I'v been working on it and somehow lost the jenkins-token-xxxx secret, it's literally gone from the cluster any idea how to recover it, if possible? (the weird thing is I didn't delete it, it just dissapeared)

I did a quick helm install stable/jenkins --name jenkins on minikube to show what's missing

$ kubectl get secrets -o wide
NAME                  TYPE                                  DATA   AGE
default-token-lvkpt   kubernetes.io/service-account-token   3      6d19h
jenkins               Opaque                                2      18m
jenkins-token-rxh2d   kubernetes.io/service-account-token   3      18m <-------

On cluster:

$ kubectl get secrets
NAME                                                TYPE                                  DATA   AGE
default-token-xyzca                                 kubernetes.io/service-account-token   3      yd
jenkins                                             Opaque                                2      yd
jenkins-nginx-nginx-ingress-backend-token-xxxx     kubernetes.io/service-account-token   3      yd
jenkins-nginx-nginx-ingress-token-zzzz             kubernetes.io/service-account-token   3      yd
-- CptDolphin
containers
jenkins
kubernetes
kubernetes-helm

1 Answer

1/14/2020

You can run:

kubectl get secret jenkins -oyaml

-- VĂ­ctor Oriol
Source: StackOverflow