Skip to content

Latest commit

 

History

History
83 lines (64 loc) · 4.08 KB

README.md

File metadata and controls

83 lines (64 loc) · 4.08 KB

Terraform Kubernetes on Hetzner Cloud

This repository will help to setup an opionated Kubernetes Cluster with kubeadm on Hetzner Cloud and using AWS S3 as backend.

Usage

$ git clone https://github.com/titanlien/terraform-k8s-hcloud.git
$ terraform init
$ terraform apply

Provision with Ansible

cd ansible/
pipenv sync
ansible-playbook -e sshKey=/Users/titan/.ssh/id_rsa -i inventory site.yaml

Variables

Name Default Description Required
hcloud_token `` API Token that will be generated through your hetzner cloud project https://console.hetzner.cloud/projects Yes
master_count 1 Amount of masters that will be created No
master_image [SNAPSHOT_ID] Predefined Image that will be used to spin up the machines (Currently supported: ubuntu-16.04, debian-9,centos-7,fedora-27) No
master_type cx11 Machine type for more types have a look at https://www.hetzner.de/cloud No
node_count 1 Amount of nodes that will be created No
node_image [SNAPSHOT_ID] Predefined Image that will be used to spin up the machines (Currently supported: ubuntu-16.04, debian-9,centos-7,fedora-27)
node_type cx11 Machine type for more types have a look at https://www.hetzner.de/cloud No
ssh_private_key ~/.ssh/id_ras Private Key to access the machines
ssh_public_key ~/.ssh/id_rsa.pub Public Key to authorized the access for the machines No
docker_version 18.09.06 Docker CE version that will be installed No
kubernetes_version 1.15.3 Kubernetes version that will be installed No
core_dns false Enables CoreDNS as Service Discovery No
calico_enabled false Installs Calico Network Provider after the master comes up No
All variables cloud be passed through environment variables or a tfvars file.

An example for a tfvars file would be the following terraform.tfvars

# terraform.tfvars
hcloud_token = "<yourgeneratedtoken>"
master_type = "cx11"
master_count = 1
node_type = "cx11"
node_count = 1

Or passing directly via Arguments

$ terraform apply \
  -var hcloud_token="<yourgeneratedtoken>"
  -var master_type=cx21
  -var master_count=1
  -var node_type=cx31
  -var node_count=2

Helm init with tls

$ helm init --tiller-tls --tiller-tls-cert ./pem/tiller.cert.pem --tiller-tls-key ./pem/tiller.key.pem --tiller-tls-verify --tls-ca-cert ./pem/ca.cert.pem
  • Using helm with --tls

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Tested with

  • Terraform v0.12.7
  • provider.hcloud v1.12.0
  • provider.null v2.1.2
  • provider.template v2.1.2