Open roncemer opened 1 month ago
Hi @roncemer,
Suppose you will apply the same definition with kubectl apply -f <file.yaml>
you will have the same result.
It seems that the request of a service account token is not supported yet in kubernetes.core
collections, you can create Feature request or make with requested feathere a PR by yourself with official kubernetes python client.
As @yurnov pointed out, you cannot create a TokenRequest resource using apply
. The TokenRequest is a subresource of a ServiceAccount. This would have to be implemented as a new module that uses the token attribute in a similar way to how we implement the k8s_scale module: https://github.com/ansible-collections/kubernetes.core/blob/c8a9326306e65c0edf945fb3e99a67937cbe9375/plugins/modules/k8s_scale.py#L375
SUMMARY
Unable to find any way to create a Kubernetes dashboard token. Typically with kubectl, this is done with the following command:
If you add -o yaml to this command, you get output similar to the following:
So I tried creating this task:
But it just generates the following error:
ISSUE TYPE
COMPONENT NAME
kubernetes.core.k8s
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Darwin ***-**.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020 arm64
STEPS TO REPRODUCE
Set the kubeconfig fact to the path to a valid kubeconfig file for the cluster, then run the following task.
EXPECTED RESULTS
Create and output the dashboard token.
ACTUAL RESULTS
Fails with this error: