What Is RKE
Rancher Kubernetes Engine (RKE) is a CNCF-certified Kubernetes distribution that runs entirely within Docker containers. It works on bare-metal and virtualized servers. RKE solves the problem of installation complexity, a common issue in the Kubernetes community.
Download RKE Binary
Go To Here Download Binary
# Linux Platform
wget https://github.com/rancher/rke/releases/download/v1.4.1-rc2/rke_linux-amd64
mv rke_linux-amd64 rke && chmod +x rke
Create RKE Configuration
Option 1 : Use minimal cluster.yml config from rancher
# cluster.yml
nodes:
- address: 1.2.3.4
user: ubuntu
role:
- controlplane
- etcd
- worker
Option 2 : Use rke config
Create New Config
# ./rke config --name cluster.yml
[+] 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]:
.
.
.
.
Create RKE Cluster
Attentions !!! You Need Close Node's swap
, Install docker
, and Make Sure The master node
& work node
Can Access Each Other Before Create
# ./rke up
INFO[0000] Building Kubernetes cluster
INFO[0000] [dialer] Setup tunnel for host [10.0.0.1]
INFO[0000] [network] Deploying port listener containers
INFO[0000] [network] Pulling image [alpine:latest] on host [10.0.0.1]
...
INFO[0101] Finished building Kubernetes cluster successfully
Install kubectl
Download
curl -LO "https://dl.k8s.io/release/$(curl -L -s \
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Install Command
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Verify Command
./kubectl version --client
#or
kubectl version --client
Check RKE Cluster Status
./kubectl --kubeconfig kube_config_cluster.yml get nodes
#or
cat kube_config_cluster.yml > ~/.kube/config
kubectl version --client
Try Deploy Pod To RKE Cluster
cat demo/nginx.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
# pod metadata
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
Deployment
# kubectl apply -f demo/nginx.yml
deployment.apps/nginx-deployment created
Check Pods
~ # kubectl get po
NAME READY STATUS RESTARTS AGE
nginx-deployment-6c8b449b8f-6mds6 1/1 Running 0 59s
nginx-deployment-6c8b449b8f-ct6lx 1/1 Running 0 59s
nginx-deployment-6c8b449b8f-j8lrf 1/1 Running 0 59s
Remove Deployment
# kubectl delete deployment nginx-deployment
Top comments (0)