Coder Social home page Coder Social logo

yashodhank / kubernetes-kubeadm-terraform Goto Github PK

View Code? Open in Web Editor NEW

This project forked from admantium-sg/kubernetes-kubeadm-terraform

0.0 0.0 0.0 18 KB

Creates a kubeadm cluster in the Hetzner cloud

License: MIT License

Shell 26.18% HCL 73.82%

kubernetes-kubeadm-terraform's Introduction

K8S Kubeadm Cluster with Terraform

This repository creates a kubeadm cluster with the Hetzner cloud.

The preconfigured components are etcd, containerd and calico.

Prerequisites

Usage

Export your Hetzner cloud access token as an environment variable, select the staging workspace, and start deploying.

export TF_VAR_hcloud_token=SECRET

terraform init
terraform workspace new staging
terraform apply

Then, access your cluster via SSH and grab the kubeconfig file:

ssh root@${$(terraform output controller_ip)//\"/} \
  -o StrictHostKeyChecking=no \
  -i .ssh-${$(terraform workspace show)//\"/}/id_rsa.key \
  -c "cat /root/.kube/config"

Customization

Kubernetes Version

The default value is v1.26.4, change it in bin/01_install.sh:

KUBERNETES_VERSION=1.26.4

Cluster Nodes

The variables.tf file contains the configuration which Hetzner server type to use and the number and name for the controller and worker nodes. It also distinguishes into two workspaces with different number of nodes:

  • staging: 1 controller (cx21), 2 worker nodes (cpx21)
  • production: 1 controller (cx31), 4 worker nodes (cpx31)

Edit the variables.tf to change this.

Switch the workspace with terraform workspace select staging or terraform workspace select production, and use terraform refresh to get the current controller IP address.

Known Limitations

  • Currently, only 1 controller node can be provisioned
  • The default user on the node is root

kubernetes-kubeadm-terraform's People

Contributors

admantium-sg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.