Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 1.7 KB

README.md

File metadata and controls

71 lines (53 loc) · 1.7 KB

Kubernetes on Bare Metal with Terraform

Used to quickly provision a single node cluster in a libvirt environment

Adapted from - https://blog.alexellis.io/kubernetes-in-10-minutes/

Additional details can be found here:

Prereqs

Before you begin you must first install Terraform and the terraform-provider-libvirt

Setup

Clone Repository

git clone https://github.com/2stacks/terraform-kbm.git
cd terraform-kbm

Create secrets variable file and add your SSH public key

cp secret.auto.tfvars.example secret.auto.tfvars

Deploy libvirt guest with Terraform

terraform init
terraform plan
terraform apply

When Terrafrom finishes it will output the libvirt guest IP

Example:

Outputs:

ip = [
    [
        192.168.122.139,
        fe80::5054:ff:fec2:43bd
    ]
]

Log in to the newly created guest to verify the installation and to retrieve the dashboard token.

ssh 192.168.122.139

kubectl get all --namespace=kube-system
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

Copy the admin-user token then start the kube-proxy

kubectl proxy

From a seperate terminal window set up an ssh tunnel to the guest IP

ssh -L 8001:127.0.0.1:8001 -N 192.168.122.139

Access the following URL from your local machine's browser and log in with copied admin-user token