在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):xetys/hetzner-kube开源软件地址(OpenSource Url):https://github.com/xetys/hetzner-kube开源编程语言(OpenSource Language):Go 97.0%开源软件介绍(OpenSource Introduction):hetzner-kube: fast and easy setup of kubernetes clusters on Hetzner CloudThis project contains a CLI tool to easily provision kubernetes clusters on Hetzner Cloud. This is my very first tool written in Go. How to installBinary releasesGet the binary from releases page From source
To get and build
The project source will now be in your If you want to build it yourself later, you can change into the source directory and run Code completionBASHTo load completion run source <(hetzner-kube completion bash) To configure your bash shell to load completions for each session add to your "~/.bashrc" file # ~/.bashrc or ~/.profile
echo 'source <(hetzner-kube completion bash)\n' >> ~/.bashrc Or you can add it to your # On linux
hetzner-kube completion bash > /etc/bash_completion.d/hetzner-kube
# On OSX with completion installed via brew (`brew install bash-completion`)
hetzner-kube completion bash > /usr/local/etc/bash_completion.d/hetzner-kube ZSHTo configure your zsh shell to load completions run following commands: # On linux
hetzner-kube completion zsh | sudo tee /usr/share/zsh/vendor-completions/_hetzner-kube
# On OSX
hetzner-kube completion zsh | sudo tee /usr/share/zsh/site-functions/_hetzner-kube Than rebuild autocomplete function with:
UsageIn your Hetzner Console generate an API token and $ hetzner-kube context add my-project
Token: <PASTE-TOKEN-HERE> Then you need to add an SSH key: $ hetzner-kube ssh-key add -n my-key This assumes, you already have a SSH keypair And finally, you can create a cluster by running: $ hetzner-kube cluster create --name my-cluster --ssh-key my-key This will provision a brand new kubernetes cluster in latest version! To access the cluster via kubectl, create a config file: # Write ~/.kube/config (you'll be asked to overwrite if file already exists)
hetzner-kube cluster kubeconfig my-cluster
# Alternatively, create a separate file and point kubectl to it:
#hetzner-kube cluster kubeconfig --print my-cluster > ~/.kube/config-my-cluster
#export KUBECONFIG=~/.kube/config-my-cluster For a full list of options that can be passed to the HA-clustersYou can build high available clusters with hetzner-kube. Read the High availability Guide for further information. Custom OptionsaddonsYou can install some addons to your cluster using the $ hetzner-kube cluster addon list contributing new addonsYou want to add some cool stuff to hetzner-kube? It's quite easy! Learn how to add new addons in the Developing Addons documentation. backup & restore (for HA-clusters)If you are running an external etcd cluster, you can use the etcd management to backup the etcd cluster using $ hetzner-kube cluster etcd backup my-cluster --snapshot-name my-snapshot ( and restore it using $ hetzner-kube cluster etcd restore my-cluster --snapshot-name my-snapshot If you place a different snapshot (with phasesAfter a cluster is once created (nodes creation is enough), you can perform the steps from
You can use $ hetzner-kube cluster phase -h to only list all available phases. Cluster creation is a chain of these phases:
Some of theses phase have additional options, to run the actual phase differently from the usual cluster creation. examples for phasesTo simply run a phase from cluster creation, you cam run a phase, eg. the $ hetzner-kube cluster phase etcd my-cluster In order to upgrade or migrate a cluster, you might want to keep the etcd data, and run $ hetzner-kube cluster phase etcd my-cluster --keep-data and preserve the existing certificates using $ hetzner-kube cluster phase install-master my-cluster --keep-all-certs The latter command can be also useful during cluster migration, if you place the existing certs
in /etc/kubernetes/pki before running the cloud-initIf you like to run some scripts or install some additional packages while provisioning new servers, you can use cloud-init
An example file to make all nodes ansible ready. The comment on the first line is important: #cloud-config
package_update: true
packages:
- python Full tutorialThis article guides through a full cluster setup. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论