rancher / rke

Rancher Kubernetes Engine (RKE), an extremely simple, lightning fast Kubernetes distribution that runs entirely within containers.
Apache License 2.0
3.21k stars 582 forks source link

Refactor rke config to current behavior #2149

Open oskapt opened 4 years ago

oskapt commented 4 years ago

RKE version:

1.0.4

Steps to Reproduce:

➤ rke config -l -a
v1.15.9-rancher1-1
v1.16.6-rancher1-2
v1.17.2-rancher1-2
~/D/w/m/r/rke|master✓
➤ rke config --version v1.16.6-rancher1-2
[+] Cluster Level SSH Private Key Path [~/.ssh/id_rsa]:
[+] Number of Hosts [1]:
[+] SSH Address of host (1) [none]:
[+] SSH Port of host (1) [22]:
[+] SSH Private Key Path of host () [none]:
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host () [none]:
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_rsa
[+] SSH User of host () [ubuntu]:
[+] Is host () a Control Plane host (y/n)? [y]:
[+] Is host () a Worker host (y/n)? [n]:
[+] Is host () an etcd host (y/n)? [n]:
[+] Override Hostname of host () [none]:
[+] Internal IP of host () [none]:
[+] Docker socket path on host () [/var/run/docker.sock]:
[+] Network Plugin Type (flannel, calico, weave, canal) [canal]:
[+] Authentication Strategy [x509]:
[+] Authorization Mode (rbac, none) [rbac]:
[+] Kubernetes Docker image [rancher/hyperkube:v1.17.2-rancher1]:
[+] Cluster domain [cluster.local]:
[+] Service Cluster IP Range [10.43.0.0/16]:
[+] Enable PodSecurityPolicy [n]:
[+] Cluster Network CIDR [10.42.0.0/16]:
[+] Cluster DNS Service IP [10.43.0.10]:
[+] Add addon manifest URLs or YAML files [no]:
~/D/w/m/r/rke|master✓
➤ grep kubernetes cluster.yml
  kubernetes_services_sidecar: rancher/rke-tools:v0.1.52
  kubernetes: rancher/hyperkube:v1.17.2-rancher1
kubernetes_version: ""

Results:

  1. The presented default is not hyperkube:v1.16.6-rancher1
  2. Regardless of version provided to rke config --version, kubernetes uses the default version in cluster.yml

-- Edit superseb -- This includes refactoring rke config to match the current standards:

superseb commented 4 years ago

This option was added to support listing system-images per version:

            cli.StringFlag{
                Name:  "version",
                Usage: "Generate the default system images for specific k8s versions",
            },

If there is any documentation stating this can be used to setup the cluster yaml, this needs to be changed asap.

And in the process of fixing this, rke config needs to be refactored to use the latest best practices, e.g. using kubernetes_version vs setting system_images amongst other things that have changed in the past.

oskapt commented 4 years ago

I don't know if there's any documentation, but here's the question - if each version of RKE can install three versions of Kubernetes, how do you get it to install anything other than the most recent one? It would seem like you would set this as part of rke config, and the --version flag that's available seems like the way you would do it.

capta1nk1rk commented 3 years ago

@superseb Lab 2 of Rancher Academy actually mentions the use of the rke config --versionfor configuring the kube version in part 1a. This should be removed from that lab writeup.

oskapt commented 3 years ago

@superseb Lab 2 of Rancher Academy actually mentions the use of the rke config --versionfor configuring the kube version in part 1a. This should be removed from that lab writeup.

I've removed this from Lab 2.