All Projects → gammpamm → Hcloud K8s

gammpamm / Hcloud K8s

Licence: mit
Hetzner Kubernetes Cluster Installation with Private Networking

Labels

Projects that are alternatives of or similar to Hcloud K8s

Packet Terraform
Terraform scripts for packet.net
Stars: ✭ 29 (-27.5%)
Mutual labels:  hcl
Rancher Tf Mc
Stars: ✭ 33 (-17.5%)
Mutual labels:  hcl
Terraform Aws Redshift
Terraform module which creates Redshift resources on AWS
Stars: ✭ 36 (-10%)
Mutual labels:  hcl
Terraform Aws Cross Account Role
A Terraform module to create an IAM Role for Cross Account delegation.
Stars: ✭ 30 (-25%)
Mutual labels:  hcl
Vector Test Harness
End-to-end test harness for the Vector observability data router
Stars: ✭ 32 (-20%)
Mutual labels:  hcl
K8s Digitalocean Terraform
Deploy latest Kubernetes cluster on DigitalOcean using Terraform
Stars: ✭ 33 (-17.5%)
Mutual labels:  hcl
Cloud crack
Crack passwords using Terraform and AWS
Stars: ✭ 29 (-27.5%)
Mutual labels:  hcl
Dcos Up
Launch DC/OS on AWS with Terraform and Consul
Stars: ✭ 38 (-5%)
Mutual labels:  hcl
Ebs bckup
Stars: ✭ 32 (-20%)
Mutual labels:  hcl
Terraform Azurerm Network Security Group
Terraform module to create a network security group and assign it to the specified subnet
Stars: ✭ 36 (-10%)
Mutual labels:  hcl
Wordpress Ecs
Terraform and packer file to deploy Wordpress on Amazon ECS
Stars: ✭ 30 (-25%)
Mutual labels:  hcl
Aws Infrastructure
Boilerplate for a standard AWS infrastructure
Stars: ✭ 31 (-22.5%)
Mutual labels:  hcl
Terraform Reference
Terraform reference / skel Control Repo for building for building multi-tier services
Stars: ✭ 33 (-17.5%)
Mutual labels:  hcl
Terraform Course
Course files for my Udemy course about Terraform
Stars: ✭ 951 (+2277.5%)
Mutual labels:  hcl
Terraform Examples
Terraform Examples
Stars: ✭ 37 (-7.5%)
Mutual labels:  hcl
Kubernetes Terraform Scaleway
Terraform formula for creating a Kubernetes cluster running on Scaleway
Stars: ✭ 29 (-27.5%)
Mutual labels:  hcl
Terraform Google Log Export
This module allows you to create log exports at the project, folder, or organization level.
Stars: ✭ 33 (-17.5%)
Mutual labels:  hcl
Terraform Gcp Kubernetes Traefik
Little example of how to deploy a gke cluster with terraform and use traefik as ingress controller
Stars: ✭ 39 (-2.5%)
Mutual labels:  hcl
Karch
A Terraform module to create and maintain Kubernetes clusters on AWS easily, relying entirely on kops
Stars: ✭ 38 (-5%)
Mutual labels:  hcl
Terraform Aws Ecs Fargate
Terraform module which creates ECS Fargate resources on AWS.
Stars: ✭ 35 (-12.5%)
Mutual labels:  hcl

hcloud-k8s

unfortunately I have no time to maintain - please fork it

Install a Kubernetes Cluster on Hetzner Cloud. The Playbook install a Master and Workers with Private Networking inclusive Cloud Controller Manager for Hetzner Cloud, Load Balancer and Failover IPs.

Tested Versions Kubernetes v1.15.5 and v1.16.2

Local Requirements

Prerequirments edit the following files

  • create a HCloud Project in Hetzner Cloud Console
  • create a API Token and set in "env/values.yaml"
  • edit the values in "env/values.yaml"

Create Infrastructure Ansible Playbook Terrafom Module

ansible-playbook create-infrastructure.yaml

After creation is complete waiting 5 Minutes, because Hetzner install the "roles/tf-infrastructure/terraform/user-data/cloud-config.yaml" (Docker, Kubelet, Kubeadm, Kubectl, SSH Keys) The Playbook execute Terraform and apply the resources. The working directory is "roles/tf-infrastructure/terraform/"

Install Kubernetes Ansible Playbook

ansible-playbook k8s-install.yaml -i env/inventory

Install Kubernetes, Master, Workers, Metal Load Balancer, FIP Controller for IP failover.

Test on your local machine if all works after few minutes:

kubectl get pods --all-namespaces

Get Kube Config from Master Node

ansible-playbook get-kubeconfig.yaml -i env/inventory

Delete Kubernetes and destroy Infrastructure Ansible Playbook Terrafom Module

ansible-playbook destroy-infrastructure.yaml

The Playbook execute Terraform and destroy the resources (Delete Instances, Floating IPs, Networks). The working directory is "roles/tf-infrastructure/terraform/"

What's happening

  • Create Infrastructure on Hetzner Cloud with Terraform (roles/tf-infrastructure/terraform/)
  • Prepare Kubernetes Tools and Configuration on all Servers
  • Install Master-Node
  • Join Worker-Nodes to Master
  • Install Metal Load Balancer and IP failover Configuration (FIP)
  • Cleanup

Caution Security

Info MetalLB

Hetzner Cloud does not support LoadBalancer as a Service (yet). Thus MetalLB will be installed to make the LoadBalancer service type available in the cluster.

A Kubernetes LoadBalancer is typically managed by the cloud controller, but it is not implemented in the hcloud cloud controller (because its not supported by Hetzner Cloud). MetalLB is a project, which provides the LoadBalancer type for baremetal Kubernetes clusters. It announces changes of the IP address endpoint to neighbor-routers, but we will just make use of the LoadBalancer provision in the cluster.

This will configure MetalLB to use the IPv4 floating IP as LoadBalancer IP. MetalLB can reuse IPs for multiple LoadBalancer services if some conditions are met. This can be enabled by adding an annotation metallb.universe.tf/allow-shared-ip to the service.

Info floating IP failover

As the floating IP is bound to one server only I wrote a little controller, which will run in the cluster and reassign the floating IP to another server, if the currently assigned node becomes NotReady.

If you do not ensure, that the floating IP is always associated to a node in status Ready your cluster will not be high available, as the traffic can be routed to a (potentially) broken node.

Hetzner Cloud floating IP controller

If you did not set up the hcloud cloud controller, the external IP of the nodes might be announced as internalIP of the nodes in the Kubernetes cluster. In that event you must change nodeAddressType in the config to internal for the floating IP controller to work correctly.

Please be aware, that the project is still in development and the config might be changed drastically in the future. Refer to the GitHub repository for config options etc.

Credits

Credits for Installation Manual: https://github.com/cbeneke/

Ansible and Terraform created by: https://github.com/gammpamm/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].