From 7c315b4dff93ce37cc2fc18524f3575a199d3549 Mon Sep 17 00:00:00 2001 From: Karim Naufal Date: Sun, 27 Feb 2022 10:28:16 +0100 Subject: [PATCH] tweaked readme --- README.md | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 2f29ae8..638b6bf 100644 --- a/README.md +++ b/README.md @@ -54,15 +54,14 @@ Follow those simple steps, and your world's cheapest Kube cluster will be up and First and foremost, you need to have a Hetzner Cloud account. You can sign up for free [here](https://hetzner.com/cloud/). -Then you'll need to have [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) and [kubectl](https://kubernetes.io/docs/tasks/tools/) cli installed. The easiest way is to use the [gofish](https://gofi.sh/#install) package manager to install them. +Then you'll need to have [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli), [kubectl](https://kubernetes.io/docs/tasks/tools/) cli, and [hcloud]() the Hetzner cli. The easiest way is to use the [gofish](https://gofi.sh/#install) package manager to install them. ```sh gofish install terraform gofish install kubectl +gofish install hcloud ``` -_The Hetzner cli `hcloud` is also useful to have, mainly for debugging without having to use the Hetzner website. See how to install it [here](https://github.com/hetznercloud/cli)._ - ### 💡 [Do not skip] Creating the terraform.tfvars file 1. Create a project in your [Hetzner Cloud Console](https://console.hetzner.cloud/), and go to **Security > API Tokens** of that project to grab the API key. Take note of the key! ✅ @@ -98,27 +97,6 @@ When the cluster is up and running, you can do whatever you wish with it! 🎉 To scale the number of nodes up or down, just make sure to properly `kubectl drain` the nodes in question first if scaling down. Then just edit these variables in `terraform.tfvars` and re-apply terraform with `terraform apply -auto-approve`. -### Useful Commands - -- List your nodes IPs, with either of those: - -```sh -terraform outputs -hcloud server list -``` - -- See the Hetzner network config: - -```sh -hcloud network describe k3s -``` - -- Log into one of your nodes (replace the location of your private key if needed): - -```sh -ssh root@xxx.xxx.xxx.xxx -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no -``` - ## High Availability By default, we have 3 control planes and 2 agents configured, with automatic upgrades and reboots of the nodes. @@ -188,6 +166,25 @@ spec: +## Debugging + +First and foremost, it depends, but it's always good to have a quick look into Hetzner quickly without having to login to the UI. There where the `hcloud` cli comes in. + +- Activate it with `hcloud context create kube-hetzner`, it will prompt for your Hetzner API token, paste that and hit `enter`. +- To check the nodes, if they are running, for instance, use `hcloud server list`. +- To check the network use `hcloud network describe k3s`. +- To see a look at the LB, use `hcloud loadbalancer describe traefik`. + +Then for the rest, you'll often need to login to your cluster via ssh, to do that, use: + +```sh +ssh root@xxx.xxx.xxx.xxx -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no +``` + +Then, for control-plane nodes, use `journalctl -u k3s` to see the k3s logs, and for agents, use `journalctl -u k3s-agents` instead. + +Last but not least, to see when the last reboot took place, you can use both `last reboot`and `uptime`. + ## Takedown If you want to takedown the cluster, you can proceed as follows: