Skip to content

Commit

Permalink
k0s -> k3s
Browse files Browse the repository at this point in the history
  • Loading branch information
dudo committed Apr 14, 2024
1 parent 9cfe98d commit 6ff394b
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 41 deletions.
21 changes: 3 additions & 18 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
# frozen_string_literal: true

tap 'siderolabs/talos'
brew 'siderolabs/talos/talosctl'

brew 'crane'

tap 'metalbear-co/mirrord'
brew 'metalbear-co/mirrord/mirrord'

tap 'fluxcd/tap'
brew 'fluxcd/tap/flux'

tap 'k0sproject/tap'
brew 'k0sproject/tap/k0sctl'

brew 'kubernetes-cli'

brew 'helm'

brew 'cilium-cli'

brew 'kubeseal'

brew 'cloudflared'
brew 'helm'
brew 'kubernetes-cli'
brew 'kubeseal'
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ xz -d ubuntu-22.04.3-preinstalled-desktop-arm64-turing-rk1_v1.32.img.xz
tpi flash -n N -i /mnt/sdcard/ubuntu-22.04.3-preinstalled-server-arm64-turing-rk1_v1.32.img
```

### Kubernetes (via k0s)
### Kubernetes (via k3s)

An open-source system for automating deployment, scaling, and management of containerized applications.

<https://k0sproject.io/>
<https://docs.k3s.io/>

### Flux

Expand Down Expand Up @@ -101,14 +101,28 @@ brew bundle

When spinning up the cluster for the first time, there are 3 primary steps.

1. Install `k0s`
1. Install `k3s`

<https://docs.k0sproject.io/v1.29.1+k0s.1/k0sctl-install/>
<https://docs.turingpi.com/docs/turing-pi2-kubernetes-installation>
<https://docs.k3s.io/installation/configuration>
<https://docs.k3s.io/installation/network-options>

```sh
k0sctl apply --config ./clusters/overlays/local/k0s.yaml
k0sctl kubeconfig --config ./clusters/overlays/local/k0s.yaml
# add the output of this to ~/.kube/config
# Controller
curl -sfL https://get.k3s.io | sh -s - \
--write-kubeconfig-mode 644 \
--token toooookkkkeeennnnnnn \
--node-ip 192.168.4.78 \
--flannel-backend=none \
--disable-cloud-controller \
--disable-kube-proxy \
--disable-network-policy \
--disable local-storage \
--disable servicelb \
--disable traefik

# Workers
curl -sfL https://get.k3s.io | K3S_URL=https://192.168.4.78:6443 K3S_TOKEN=toooookkkkeeennnnnnn sh -
```

2. Install `cilium`
Expand Down Expand Up @@ -190,18 +204,6 @@ data:
EOF
```

### Reset

Tearing down the cluster is a 1 step process.

1. Reset the cluster

<https://docs.k0sproject.io/v1.28.2+k0s.0/reset/>

```sh
k0sctl reset --config ./clusters/overlays/local/k0s.yaml
```

## Pertinent Sections

- [Apps](./apps)
Expand Down
8 changes: 4 additions & 4 deletions clusters/overlays/local/k0s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ spec:
keyPath: ~/.ssh/id_rsa
role: worker
installFlags:
- --labels="tp2.turingpi.com/slot=2,kubernetes.io/role=worker"
- --labels="tp2.turingpi.com/slot=2"
- ssh:
address: 192.168.4.80
user: dudo
port: 22
keyPath: ~/.ssh/id_rsa
role: worker
installFlags:
- --labels="tp2.turingpi.com/slot=3,kubernetes.io/role=worker"
- --labels="tp2.turingpi.com/slot=3"
- ssh:
address: 192.168.4.53
user: dudo
port: 22
keyPath: ~/.ssh/id_rsa
role: worker
installFlags:
- --labels="tp2.turingpi.com/slot=4,kubernetes.io/role=worker"
- --labels="tp2.turingpi.com/slot=4"
k0s:
version: 1.29.1+k0s.1
version: 1.29.2+k0s.0
versionChannel: stable
config:
apiVersion: k0s.k0sproject.io/v1beta1
Expand Down
6 changes: 6 additions & 0 deletions manifests/base/system-upgrade-controller/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: flux-system
resources:
- source.yaml
44 changes: 44 additions & 0 deletions manifests/base/system-upgrade-controller/plan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# Server plan
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
name: server-plan
namespace: rancher
spec:
concurrency: 1
cordon: true
nodeSelector:
matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: In
values:
- "true"
serviceAccountName: system-upgrade
upgrade:
image: rancher/k3s-upgrade
channel: https://update.k3s.io/v1-release/channels/stable

---
# Agent plan
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
name: agent-plan
namespace: rancher
spec:
concurrency: 1
cordon: true
nodeSelector:
matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
prepare:
args:
- prepare
- server-plan
image: rancher/k3s-upgrade
serviceAccountName: system-upgrade
upgrade:
image: rancher/k3s-upgrade
channel: https://update.k3s.io/v1-release/channels/stable
27 changes: 27 additions & 0 deletions manifests/base/system-upgrade-controller/source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: system-upgrade-controller
spec:
interval: 24h
ref:
branch: master
url: https://github.com/rancher/system-upgrade-controller

---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: system-upgrade-controller
spec:
interval: 12h
sourceRef:
kind: GitRepository
name: system-upgrade-controller
namespace: flux-system
targetNamespace: rancher
path: ./
prune: true
wait: true
timeout: 5m

0 comments on commit 6ff394b

Please sign in to comment.