If RKE
environment is not prepared yet, please follow this installation guid. Before setup the RKE
cluster, please check ip
address on all nodes.
- create a cluster config file, name as
rancher-cluster.yaml
.
vi rancher-cluster.yaml
rancher-cluster.yaml
nodes:
- address: 192.168.123.9
user: dockeruser
role: [controlplane, etcd, worker]
- address: 192.168.123.10
user: dockeruser
role: [controlplane, etcd, worker]
- address: 192.168.123.11
user: dockeruser
role: [controlplane, etcd, worker]
services:
etcd:
snapshot: true
backup: false
creation: 6h
retention: 24h
- Run
rke up
commend to start the cluster. It will to take too long to base on internet connection and hardware resources.
$ rke up --config rancher-cluster.yaml
If the message Finished building Kubernetes cluster successfully
is got, the kubernetes
cluster is successfully setup.
- Set the
KUBECONFIG
environmental variable to the path ofkube_config_rancher-cluster.yaml
which created byRKE
installation.
export KUBECONFIG=$(pwd)/kube_config_rancher-cluster.yaml
- Check all of nodes status on the
RKE
cluster
$ kubectl get nodes
- Check all of pods status on the
RKE
cluster.
$ kubectl get pods --all-namespaces
Most are Running
and Completed
.
The Rancher UI is used to manage from a Web interface.
- Install Rancher UI on Rancher-VM
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:stable
2.If Rancher UI is sucessfully installed, go http://<IP-ADDRESS>
and login.
- Click
Add Cluster
. - Select
Import
and give the cluster name. Eg. name likerke-cluster
- Click
Create
. it will show the following screen.
- Click 3rd
Copy to Clipboard
- Modify the copy string as below. Make sure to add
--kubeconfig kube_config_rancher-cluster.yaml
.
curl --insecure -sfL https://192.168.123.8/v3/import/h97g6whx7nbkpbqkc98xkvp4dzwmn49nn9bmdzhcnpgshqm45h2d9p.yaml | kubectl --kubeconfig kube_config_rancher-cluster.yml apply -f -
- Run No.5 command on
Rancher
VM.
- Click
Done
on Rancher UI.
Import porcess take a few minutes.
When rke-cluster
is active. click the link to check the status.
For more information Rancher High Availability (HA) Install.
Failed to start [rke-etcd-port-listener] container on host [192.168.123.11]: Error response from daemon: driver failed programming external connectivity on endpoint rke-etcd-port-listener (c35e1742f00f349baac3d57b968f2bf30c6b2eb82a586d4641e29f447f295d2c): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 2380 -j DNAT --to-destination 172.17.0.2:1337 ! -i docker0: iptables: No chain/target/match by that name. (exit status 1))
- Delete all docker image and container on all nodes.
$ docker system prune && docker rm $(docker ps -a -q) -f && docker rmi $(docker images -q) -f
- Restart docker on all nodes
$ systemctl restart docker
- Install
rke
agian
$ rke up --config rancher-cluster.yaml