k3s/cmd
Kubernetes Submit Queue 0abcd5d51b Merge pull request #41663 from luxas/kubeadm_new_token_cmd
Automatic merge from submit-queue (batch tested with PRs 42053, 41282, 42056, 41663, 40927)

Update kubeadm token to work as expected

**What this PR does / why we need it**:

Follows up: https://github.com/kubernetes/kubernetes/pull/41509

Updates `kubeadm token` to work as discussed in https://docs.google.com/document/d/1deJYPIF4LmhGjDVaqrswErIrV7mtwJgovtLnPCDxP7U/edit#
Promotes the command from the `ex` subcommand which now is named `alpha` for clarity. (This will later become `kubeadm alpha phase`)

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

Example UX:
```console
sudo ./kubeadm token --help
This command will manage Bootstrap Token for you.
  Please note this usage of this command is optional, and mostly for advanced users.

In short, Bootstrap Tokens are used for establishing bidirectional trust between a client and a server.
A Bootstrap Token can be used when a client (for example a node that's about to join the cluster) needs
to trust the server it is talking to. Then a Bootstrap Token with the "signing" usage can be used.
Bootstrap Tokens can also function as a way to allow short-lived authentication to the API Server
(the token serves as a way for the API Server to trust the client), for example for doing the TLS Bootstrap.

What is a Bootstrap Token more exactly?
 - It is a Secret in the kube-system namespace of type "bootstrap.kubernetes.io/token".
 - A Bootstrap Token must be of the form "[a-z0-9]{6}.[a-z0-9]{16}"; the former part is the public Token ID,
   and the latter is the Token Secret, which must be kept private at all circumstances.
 - The name of the Secret must be named "bootstrap-token-(token-id)".

You can read more about Bootstrap Tokens in this proposal:

  https://github.com/kubernetes/community/blob/master/contributors/design-proposals/bootstrap-discovery.md

Usage:
  kubeadm token [flags]
  kubeadm token [command]

Available Commands:
  create      Create bootstrap tokens on the server.
  delete      Delete bootstrap tokens on the server.
  generate    Generate and print a bootstrap token, but do not create it on the server.
  list        List bootstrap tokens on the server.

Flags:
      --kubeconfig string   The KubeConfig file to use for talking to the cluster (default "/etc/kubernetes/admin.conf")

Use "kubeadm token [command] --help" for more information about a command.
lucas@THENINJA:~/luxas/kubernetes$ sudo ./kubeadm token list
TOKEN                     TTL         EXPIRES   USAGES                   DESCRIPTION
70c388.41a07b703aa4bedf   <forever>   <never>   authentication,signing   The default bootstrap token generated by 'kubeadm init'.
lucas@THENINJA:~/luxas/kubernetes$ sudo ./kubeadm token create
c57e6a.abb75fa1debe555f
lucas@THENINJA:~/luxas/kubernetes$ sudo ./kubeadm token list
TOKEN                     TTL         EXPIRES   USAGES                   DESCRIPTION
70c388.41a07b703aa4bedf   <forever>   <never>   authentication,signing   The default bootstrap token generated by 'kubeadm init'.
c57e6a.abb75fa1debe555f   <forever>   <never>   authentication,signing   <none>
lucas@THENINJA:~/luxas/kubernetes$ sudo ./kubeadm token create s
token ["s"] was not of form ["^([a-z0-9]{6})\\.([a-z0-9]{16})$"]
lucas@THENINJA:~/luxas/kubernetes$ sudo ./kubeadm token create c57e6a.abb75fa1debe555f
a token with id "c57e6a" already exists
lucas@THENINJA:~/luxas/kubernetes$ sudo ./kubeadm token delete c57e6a.abb75fa1debe555f
bootstrap token with id "c57e6a" deleted
```

**Release note**:

```release-note
NONE
```
@dmmcquay @jbeda @mikedanese @errordeveloper @pires
2017-02-27 12:45:34 -08:00
..
clicheck Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
cloud-controller-manager Update bazel 2017-02-27 06:48:13 -05:00
gendocs Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
genkubedocs Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
genman Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
genslateyaml Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
genswaggertypedocs start the apimachinery repo 2017-01-11 09:09:48 -05:00
genutils Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
genyaml Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
gke-certificates-controller New command: gke-certificates-controller 2017-02-24 14:35:32 -08:00
hyperkube add kube-aggregator to hyperkube 2017-02-17 08:13:11 -05:00
kube-apiserver Merge pull request #41969 from wojtek-t/use_protobufs_for_self_communication_in_apiserver 2017-02-26 12:57:56 -08:00
kube-controller-manager Merge pull request #42056 from ncdc/shared-informers-16-remove-legacy-code 2017-02-27 12:45:31 -08:00
kube-discovery Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
kube-proxy Export Prometheus metrics in kube-proxy 2017-02-25 16:48:43 +01:00
kubeadm kubeadm: Implement the kubeadm token command fully and move it out of the experimental subsection 2017-02-27 12:56:03 +02:00
kubectl *: update codegen and bazel 2017-02-21 09:26:03 -08:00
kubelet Merge pull request #41941 from dashpole/deprecation 2017-02-26 06:46:59 -08:00
kubemark Updated NodeRef to clientv1.ObjectReference. 2017-02-07 06:27:06 +08:00
libs/go2idl Revert "Merge pull request #40088 from jsafrane/storage-ga-v1" 2017-02-25 22:35:15 -05:00
linkcheck Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
mungedocs Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
BUILD New command: gke-certificates-controller 2017-02-24 14:35:32 -08:00
OWNERS Updated top level owners file to match new format 2017-01-19 11:29:16 -08:00