0

How can I retrieve the root token from a KubeApps deployment?

2
  • What details or clarity is needed here, it's a self answered question? Jun 16 at 15:29
  • Note this is self-answered. Jun 20 at 3:43

1 Answer 1

0

When you set up a KubeApps deployment you must install a Kubernetes secret, currently the installation instructions detail it like this,


kubectl create clusterrolebinding kubeapps-operator --clusterrole=cluster-admin --serviceaccount=default:kubeapps-operator

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
  name: kubeapps-operator-token
  namespace: default
  annotations:
    kubernetes.io/service-account.name: kubeapps-operator
type: kubernetes.io/service-account-token
EOF

kubectl get --namespace default secret kubeapps-operator-token -o jsonpath='{.data.token}' -o go-template='{{.data.token | base64decode}}' && echo

So basically it's a service-account-token installed in the default namespace. You can list these like this,

 kubectl get --namespace default secrets

You specifically want the kubeapps-operator-token and you can get it with the last line,

kubectl get --namespace default secret kubeapps-operator-token -o jsonpath='{.data.token}' -o go-template='{{.data.token | base64decode}}'

The -o go-template='{{.data.token | base64decode}}' is basically just piping it to base64 -d in Go (like this).

kubectl get --namespace default secret kubeapps-operator-token -o jsonpath='{.data.token}' | base64 -d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.