5 ms·
This seems a bit scary because of its potential impact on me as a Software Developer. On the other hand, I'm also very excited to use this in personal projects
by thisisthenewme 4y ago
This seems a bit scary because of its potential impact on me as a Software Developer. On the other hand, I'm also very excited to use this in personal projects and for learning. At least at its current state, however, it doesn't seem all that trustworthy. I was trying to see if it can give me good answers to queries that I've been unable to find with Google. For instance for query "How can I generate a kubernetes token that can be used to access a cluster?", it replied with answer for kubeadmin which is reasonable because I didn't give any context. I'm using k3s so I needed an approach that worked with it. I followed up with "Is there a specific command to do the above in k3s?". It responded to that with the following.
Yes, k3s is a lightweight Kubernetes distribution that includes a utility called k3s-kubeconfig that can be used to generate Kubernetes tokens. k3s-kubeconfig is a command-line tool that is included with k3s, and it provides various subcommands for generating and managing Kubernetes tokens and configuration files.
To generate a Kubernetes token with k3s-kubeconfig, you can use the token generate subcommand. This subcommand allows you to specify the token's expiration time, as well as the authentication groups and usernames that it should be associated with.
Here is an example of how to use the k3s-kubeconfig command to generate a Kubernetes token:
k3s-kubeconfig token generate \
--ttl 24h \
--groups system:bootstrappers:kubeadm:default-node-token \
--username kubelet-bootstrap
In this example, we use the k3s-kubeconfig token generate subcommand to generate a new Kubernetes token. We specify a time-to-live (TTL) of 24 hours using the --ttl flag, and we associate the token with the system:bootstrappers:kubeadm:default-node-token authentication group and the kubelet-bootstrap username.
Please note that this is just an example, and you may need to adjust the k3s-kubeconfig command and its flags according to your specific k3s setup and configuration. For more information, you can refer to the k3s-kubeconfig documentation or consult a k3s expert.
I was initially impressed because after all my Google searches, I had never learned that there was a `k3s-kubeconfig` tool. That excitement quickly turned into amusement because turns out the tool doesn't exist.