Use RKE to install Kubernetes with a high availability etcd configuration.

Note: For systems without direct internet access see Air Gap: Kubernetes install for install details.

Create the rancher-cluster.yml File

Using the sample below create the rancher-cluster.yml file. Replace the IP Addresses in the nodes list with the IP address or DNS names of the 3 nodes you created.

Note: If your node has public and internal addresses, it is recommended to set the internal_address: so Kubernetes will use it for intra-cluster communication. Some services like AWS EC2 require setting the internal_address: if you want to use self-referencing security groups or firewalls.

  1. nodes:
  2. - address: 165.227.114.63
  3. internal_address: 172.16.22.12
  4. user: ubuntu
  5. role: [controlplane,worker,etcd]
  6. - address: 165.227.116.167
  7. internal_address: 172.16.32.37
  8. user: ubuntu
  9. role: [controlplane,worker,etcd]
  10. - address: 165.227.127.226
  11. internal_address: 172.16.42.73
  12. user: ubuntu
  13. role: [controlplane,worker,etcd]
  14. services:
  15. etcd:
  16. snapshot: true
  17. creation: 6h
  18. retention: 24h

Common RKE Nodes Options

OptionRequiredDescription
addressyesThe public DNS or IP address
useryesA user that can run docker commands
roleyesList of Kubernetes roles assigned to the node
internal_addressnoThe private DNS or IP address for internal cluster traffic
ssh_key_pathnoPath to SSH private key used to authenticate to the node (defaults to ~/.ssh/id_rsa)

Advanced Configurations

RKE has many configuration options for customizing the install to suit your specific environment.

Please see the RKE Documentation for the full list of options and capabilities.

For tuning your etcd cluster for larger Rancher installations see the etcd settings guide.

Run RKE

  1. rke up --config ./rancher-cluster.yml

When finished, it should end with the line: Finished building Kubernetes cluster successfully.

Testing Your Cluster

RKE should have created a file kube_config_rancher-cluster.yml. This file has the credentials for kubectl and helm.

Note: If you have used a different file name from rancher-cluster.yml, then the kube config file will be named kube_config_<FILE_NAME>.yml.

You can copy this file to $HOME/.kube/config or if you are working with multiple Kubernetes clusters, set the KUBECONFIG environmental variable to the path of kube_config_rancher-cluster.yml.

  1. export KUBECONFIG=$(pwd)/kube_config_rancher-cluster.yml

Test your connectivity with kubectl and see if all your nodes are in Ready state.

  1. kubectl get nodes
  2. NAME STATUS ROLES AGE VERSION
  3. 165.227.114.63 Ready controlplane,etcd,worker 11m v1.13.5
  4. 165.227.116.167 Ready controlplane,etcd,worker 11m v1.13.5
  5. 165.227.127.226 Ready controlplane,etcd,worker 11m v1.13.5

Check the Health of Your Cluster Pods

Check that all the required pods and containers are healthy are ready to continue.

  • Pods are in Running or Completed state.
  • READY column shows all the containers are running (i.e. 3/3) for pods with STATUS Running
  • Pods with STATUS Completed are run-once Jobs. For these pods READY should be 0/1.
  1. kubectl get pods --all-namespaces
  2. NAMESPACE NAME READY STATUS RESTARTS AGE
  3. ingress-nginx nginx-ingress-controller-tnsn4 1/1 Running 0 30s
  4. ingress-nginx nginx-ingress-controller-tw2ht 1/1 Running 0 30s
  5. ingress-nginx nginx-ingress-controller-v874b 1/1 Running 0 30s
  6. kube-system canal-jp4hz 3/3 Running 0 30s
  7. kube-system canal-z2hg8 3/3 Running 0 30s
  8. kube-system canal-z6kpw 3/3 Running 0 30s
  9. kube-system kube-dns-7588d5b5f5-sf4vh 3/3 Running 0 30s
  10. kube-system kube-dns-autoscaler-5db9bbb766-jz2k6 1/1 Running 0 30s
  11. kube-system metrics-server-97bc649d5-4rl2q 1/1 Running 0 30s
  12. kube-system rke-ingress-controller-deploy-job-bhzgm 0/1 Completed 0 30s
  13. kube-system rke-kubedns-addon-deploy-job-gl7t4 0/1 Completed 0 30s
  14. kube-system rke-metrics-addon-deploy-job-7ljkc 0/1 Completed 0 30s
  15. kube-system rke-network-plugin-deploy-job-6pbgj 0/1 Completed 0 30s

Save Your Files

Important The files mentioned below are needed to maintain, troubleshoot and upgrade your cluster.

Save a copy of the following files in a secure location:

  • rancher-cluster.yml: The RKE cluster configuration file.
  • kube_config_rancher-cluster.yml: The Kubeconfig file for the cluster, this file contains credentials for full access to the cluster.
  • rancher-cluster.rkestate: The Kubernetes Cluster State file, this file contains credentials for full access to the cluster.

    The Kubernetes Cluster State file is only created when using RKE v0.2.0 or higher.

Note: The “rancher-cluster” parts of the two latter file names are dependent on how you name the RKE cluster configuration file.

Issues or errors?

See the Troubleshooting page.

Next: Initialize Helm (Install tiller)