GithubHelp home page GithubHelp logo

ramses3 / hcloud-k8s-ctl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maksim-paskal/hcloud-k8s-ctl

0.0 0.0 0.0 167 KB

High available Kubernetes cluster on Hetzner Cloud with Autoscaling

License: Apache License 2.0

Shell 33.98% Go 61.55% Makefile 3.10% Roff 1.37%

hcloud-k8s-ctl's Introduction

High available Kubernetes cluster on Hetzner Cloud with Autoscaling

Motivation

AWS has eksctl tool for creating kubernetes cluster - Hetzner Cloud have no official tool for creating kubernetes cluster. This tool will create new production ready kubernetes clusters on Hetzner Cloud with minimum user interaction. New cluster will be available in High availability mode with automatic cluster autoscaling and automatic volume creation

Preparation

  • login to https://console.hetzner.cloud and create new project
  • select project, select in menu Security -> API Tokens and create new "Read & Write" token
  • save token to .hcloudauth file in current directory

Install binnary

MacOS

brew install maksim-paskal/tap/hcloud-k8s-ctl

for other OS download binnary from release pages

Create kubernetes cluster

This will create kubernetes cluster in Hetzner Cloud Europe region with 3 instances, 1 load balancer for the kubernetes control plane and 1 kubernetes worker node, after successful installation the cluster will have:

for HA needs odd number of master nodes (minimum 3) https://etcd.io/docs/v3.4/faq/#why-an-odd-number-of-cluster-members

create a simple configuration file config.yaml full configuration example here

# kubeconfig path
kubeConfigPath: ~/.kube/hcloud
# Hetzner cloud internal network CIDR
ipRange: "10.0.0.0/16"
# servers for kubernetes master (recommended 3)
# for development purposes cluster can have 1 master node  
# in this case cluster will be created without load balancer and pods can schedule on master
masterCount: 3

to create kubernetes cluster in Hetzner Cloud US region append to config.yaml next lines

networkZone: us-east
location: ash
datacenter: ash-dc1
masterServers:
  servertype: cpx21
autoscaler:
  workers:
  - location: ash
    type:
    - cpx51

and start application

# create 3 instance with 1 load balancer
# kubernetes autoscaler will create 1 worker node
hcloud-k8s-ctl -action=create

all nodes in cluster initialized with official kubeadm - for all nodes use this script, for master initializing this script, for initial applications in cluster this script

Access to cluster

export KUBECONFIG=$HOME/.kube/hcloud

kubectl get no

Patch already created cluster

hcloud-k8s-ctl -action=patch-cluster

List available location/datacenter/servertype at Hezner

hcloud-k8s-ctl -action=list-configurations

Delete already created cluster

hcloud-k8s-ctl -action=delete

To install NFS provisioner

You can easy install NFS provisioner for your cluster adding to your config.yaml next lines

deployments:
  nfs:
    nfs-subdir-external-provisioner:
      enabled: true
    server:
      enabled: true

It will install NFS Provisioner for Kubernetes (optional) with NFS Server and Storage Class

you can easy create new NFS volumes to your pod with this PersistentVolumeClaim

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-nfs
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: nfs

hcloud-k8s-ctl's People

Contributors

maksim-paskal avatar ramses3 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.