First, you have to install Docker and setup the HTTP proxy on all three Linux nodes. For this perform the following steps on all three nodes.
For convenience export the IP address and port of your proxy into an environment variable and set up the HTTP_PROXY variables for your current shell:
Next configure apt to use this proxy when installing packages. If you are not using Ubuntu, you have to adapt this step accordingly:
Acquire::http::Proxy "http://${proxy_host}/";
Acquire::https::Proxy "http://${proxy_host}/";
EOF
Now you can install Docker:
curl -sL https://releases.rancher.com/install-docker/19.03.sh | sh
Then ensure that your current user is able to access the Docker daemon without sudo:
sudo usermod -aG docker YOUR_USERNAME
To apply the configuration, restart the Docker daemon:
sudo systemctl daemon-reload
sudo systemctl restart docker
You need several command line tools on the host where you have SSH access to the Linux nodes to create and interact with the cluster:
sudo chmod +x /usr/local/bin/rke
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
Next, create a YAML file that describes the RKE cluster. Ensure that the IP addresses of the nodes and the SSH username are correct. For more information on the cluster YAML, have a look at the RKE documentation.
nodes:
- address: 10.0.1.200
user: ubuntu
role: [controlplane,worker,etcd]
- address: 10.0.1.201
user: ubuntu
role: [controlplane,worker,etcd]
user: ubuntu
role: [controlplane,worker,etcd]
etcd:
backup_config:
interval_hours: 12
retention: 6
After that, you can create the Kubernetes cluster by running:
rke up --config rancher-cluster.yaml
RKE creates a state file called rancher-cluster.rkestate
, this is needed if you want to perform updates, modify your cluster configuration or restore it from a backup. It also creates a kube_config_rancher-cluster.yaml
file, that you can use to connect to the remote Kubernetes cluster locally with tools like kubectl or Helm. Make sure to save all of these files in a secure location, for example by putting them into a version control system.
export KUBECONFIG=kube_config_rancher-cluster.yaml
kubectl cluster-info
kubectl get pods --all-namespaces
You can also verify that your external load balancer works, and the DNS entry is set up correctly. If you send a request to either, you should receive HTTP 404 response from the ingress controller:
Save a copy of the following files in a secure location:
rancher-cluster.yml
: The RKE cluster configuration file.rancher-cluster.rkestate
: The , this file contains the current state of the cluster including the RKE configuration and the certificates.
Note: The “rancher-cluster” parts of the two latter file names are dependent on how you name the RKE cluster configuration file.
See the Troubleshooting page.