Skip to content

Commit

Permalink
Replace ipsec with wireguard
Browse files Browse the repository at this point in the history
  • Loading branch information
vitobotta committed Feb 17, 2022
1 parent 64fdaa0 commit 960d513
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
hetzner-k3s (0.5.0)
hetzner-k3s (0.5.3)
bcrypt_pbkdf
ed25519
http
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This will install the `hetzner-k3s` executable in your PATH.
Alternatively, if you don't want to set up a Ruby runtime but have Docker installed, you can use a container. Run the following from inside the directory where you have the config file for the cluster (described in the next section):

```bash
docker run --rm -it -v ${PWD}:/cluster -v ${HOME}/.ssh:/tmp/.ssh vitobotta/hetzner-k3s:v0.5.2 create-cluster --config-file /cluster/test.yaml
docker run --rm -it -v ${PWD}:/cluster -v ${HOME}/.ssh:/tmp/.ssh vitobotta/hetzner-k3s:v0.5.3 create-cluster --config-file /cluster/test.yaml
```

Replace `test.yaml` with the name of your config file.
Expand Down Expand Up @@ -73,7 +73,7 @@ worker_node_pools:
instance_count: 2
additional_packages:
- somepackage
enable_ipsec_encryption: true
enable_encryption: true
```
It should hopefully be self explanatory; you can run `hetzner-k3s releases` to see a list of the available releases from the most recent to the oldest available.
Expand Down Expand Up @@ -256,9 +256,6 @@ Once the cluster is ready you can create persistent volumes out of the box with
I recommend that you create a separate Hetzner project for each cluster, because otherwise multiple clusters will attempt to create overlapping routes. I will make the pod cidr configurable in the future to avoid this, but I still recommend keeping clusters separated from each other. This way, if you want to delete a cluster with all the resources created for it, you can just delete the project.


## changelog

See changelog [here](https://github.com/vitobotta/hetzner-k3s/wiki/Changelog).
## Contributing and support

Please create a PR if you want to propose any changes, or open an issue if you are having trouble with the tool - I will do my best to help if I can.
Expand Down
6 changes: 3 additions & 3 deletions bin/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ set -e

IMAGE="vitobotta/hetzner-k3s"

docker build -t ${IMAGE}:v0.5.2 \
docker build -t ${IMAGE}:v0.5.3 \
--platform=linux/amd64 \
--cache-from ${IMAGE}:v0.5.1 \
--cache-from ${IMAGE}:v0.5.2 \
--build-arg BUILDKIT_INLINE_CACHE=1 .

docker push vitobotta/hetzner-k3s:v0.5.2
docker push vitobotta/hetzner-k3s:v0.5.3
Empty file modified bin/console.sh
100644 → 100755
Empty file.
Empty file modified bin/setup.sh
100644 → 100755
Empty file.
Empty file modified entrypoint.sh
100644 → 100755
Empty file.
Empty file modified exe/hetzner-k3s
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion lib/hetzner/infra/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def find_server(server_name)
end

def user_data
packages = ['fail2ban']
packages = ['fail2ban', 'wireguard']
packages += additional_packages if additional_packages
packages = "'#{packages.join("', '")}'"

Expand Down
8 changes: 4 additions & 4 deletions lib/hetzner/k3s/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create(configuration:)
@verify_host_key = configuration.fetch('verify_host_key', false)
@servers = []
@networks = configuration['ssh_allowed_networks']
@enable_ipsec_encryption = configuration.fetch('enable_ipsec_encryption', false)
@enable_encryption = configuration.fetch('enable_encryption', false)

create_resources

Expand Down Expand Up @@ -81,7 +81,7 @@ def upgrade(configuration:, new_k3s_version:, config_file:)
:location, :public_ssh_key_path,
:hetzner_token, :new_k3s_version, :configuration,
:config_file, :verify_host_key, :networks, :private_ssh_key_path,
:enable_ipsec_encryption
:enable_encryption

def find_worker_node_pools(configuration)
configuration.fetch('worker_node_pools', [])
Expand Down Expand Up @@ -190,7 +190,7 @@ def upgrade_cluster
def master_script(master)
server = master == first_master ? ' --cluster-init ' : " --server https://#{api_server_ip}:6443 "
flannel_interface = find_flannel_interface(master)
flannel_ipsec = enable_ipsec_encryption ? ' --flannel-backend=ipsec ' : ' '
flannel_wireguard = enable_encryption ? ' --flannel-backend=wireguard ' : ' '

taint = schedule_workloads_on_masters? ? ' ' : ' --node-taint CriticalAddonsOnly=true:NoExecute '

Expand All @@ -205,7 +205,7 @@ def master_script(master)
--node-name="$(hostname -f)" \
--cluster-cidr=10.244.0.0/16 \
--etcd-expose-metrics=true \
#{flannel_ipsec} \
#{flannel_wireguard} \
--kube-controller-manager-arg="address=0.0.0.0" \
--kube-controller-manager-arg="bind-address=0.0.0.0" \
--kube-proxy-arg="metrics-bind-address=0.0.0.0" \
Expand Down
2 changes: 1 addition & 1 deletion lib/hetzner/k3s/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Hetzner
module K3s
VERSION = '0.5.2'
VERSION = '0.5.3'
end
end

0 comments on commit 960d513

Please sign in to comment.