Skip to content

natitomattis/rke-playroom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rancher RKE using Vagrant

This is a simple Vagrantfile that allows a quick example of how to use Rancher RKE. This is not intended for anything production-related.

Tools needed

mv rke_linux-amd64 /home/${USER}/bin/rke
chmod +x /home/${USER}/bin/rke

Set up the environment

Init and provision the VMs

cd vm_setup
vagrant up
ansible-playbook -i hosts.vagrant main.yml

Create cluster config file

RKE uses cluster.yml file in order to configure the cluster, in this directory there is a default cluster.yml file. If you want to create a new one you must run. There you can select the roles of the nodes. By default, the cluster is created with the 3 vagrant VMs, and kubernetes dashboard addon is added.

rke config

In order to satart the cluster you must run

rke up

If the cluster doesn't start correctly, you can run the command once again. It retrieves a configuration file called kube_config_cluster.yml, that is used by kubectl to communicate with the cluster.

Kubectl commands

Get infra nodes

kubectl --kubeconfig kube_config_cluster.yml get nodes -o wide

Get k8s pods

kubectl --kubeconfig kube_config_cluster.yml -n kube-system get pods

Get dashboard deployment

kubectl --kubeconfig kube_config_cluster.yml get deploy -n kube-system -l k8s-app=kubernetes-dashboard

Get admin token

kubectl --kubeconfig kube_config_cluster.yml -n kube-system describe secret $(kubectl --kubeconfig kube_config_cluster.yml -n kube-system get secret | grep admin-user | awk '{print $1}') | grep ^token: | awk '{ print $2 }'

Start kubectl proxy

kubectl --kubeconfig kube_config_cluster.yml proxy

Access via web http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ To login into the dashboard use the admin token

Deploy a small application

kubectl --kubeconfig kube_config_cluster.yml run --image=superseb/rancher-demo rancher-demo --port 8080 --expose kubectl --kubeconfig kube_config_cluster.yml rollout status deployment/rancher-demo

Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages