From 8b7b24f8408a1e0fb72f1d87d17495e402994a76 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Mon, 2 Sep 2024 22:10:32 +0200 Subject: [PATCH] break: switch from k0s to k3s (in docker) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - replace k0s with k3s in docker-compose.yml - remove k0s-config.yaml - remove metallb-address-pool - update .renovaterc.json to match new file structure - add new argocd-init files for k3s - update README to reflect changes 🤖 --- .renovaterc.json | 9 ++- README.md | 8 +-- argocd-init/000-namespace.yml | 5 ++ argocd-init/001-argocd.yml | 21 +++++++ argocd-init/002-argocd-apps.yml | 50 +++++++++++++++ docker-compose.yml | 26 ++++---- k0s-config.yaml | 97 ------------------------------ manifests/metallb-address-pool.yml | 10 --- 8 files changed, 98 insertions(+), 128 deletions(-) create mode 100644 argocd-init/000-namespace.yml create mode 100644 argocd-init/001-argocd.yml create mode 100644 argocd-init/002-argocd-apps.yml delete mode 100644 k0s-config.yaml delete mode 100644 manifests/metallb-address-pool.yml diff --git a/.renovaterc.json b/.renovaterc.json index 9c73c8b..6c37c70 100644 --- a/.renovaterc.json +++ b/.renovaterc.json @@ -8,16 +8,19 @@ "customType": "regex", "description": "ArgoCD", "fileMatch": [ - "k0s-config\\.yaml$" + "^argocd-init/.*\\.yml$" ], "matchStrings": [ - "\\s+version:\\s(?.*)\\s+#\\s+depName=(?.*)\\s+repoUrl=(?.*)" + "\\s+chart:\\s(?.*)", + "\\s+repo:\\s(?.*)", + "\\s+version:\\s(?.*)" ], + "matchStringsStrategy": "combination", "datasourceTemplate": "helm" }, { "customType": "regex", - "description": "Baseline", + "description": "Baseline Manifests", "fileMatch": [ "\\.jsonnet$" ], diff --git a/README.md b/README.md index bf0f36f..d719d1e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# k0s Kubernetes + Baseline +# k3s Kubernetes + Baseline -* [k0s](https://docs.k0sproject.io/stable/) +* [k3s](https://docs.k3s.io/) * [ArgoCD](https://argoproj.github.io/cd/) * [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx/) * [cert-manager](https://cert-manager.io/) @@ -10,13 +10,13 @@ * [keel](https://keel.sh) * [reloader](https://github.com/stakater/Reloader) -## Run (k0s + baseline) +## Run (k3s + baseline) `docker compose up` ### Get kubeconfig -`docker compose exec -it k0s k0s kubeconfig admin` +`docker compose exec -it k3s kubectl config view --flatten` ## Notes diff --git a/argocd-init/000-namespace.yml b/argocd-init/000-namespace.yml new file mode 100644 index 0000000..42add95 --- /dev/null +++ b/argocd-init/000-namespace.yml @@ -0,0 +1,5 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: argocd diff --git a/argocd-init/001-argocd.yml b/argocd-init/001-argocd.yml new file mode 100644 index 0000000..9897a0d --- /dev/null +++ b/argocd-init/001-argocd.yml @@ -0,0 +1,21 @@ +--- +apiVersion: helm.cattle.io/v1 +kind: HelmChart +metadata: + name: argocd + namespace: kube-system +spec: + # do not change order! (needed for renovate) + chart: argo-cd + repo: https://argoproj.github.io/argo-helm + version: 7.5.2 + targetNamespace: argocd + valuesContent: |- + server: + replicas: 1 + applicationSet: + enabled: false + notifications: + enabled: false + dex: + enabled: false diff --git a/argocd-init/002-argocd-apps.yml b/argocd-init/002-argocd-apps.yml new file mode 100644 index 0000000..e88b761 --- /dev/null +++ b/argocd-init/002-argocd-apps.yml @@ -0,0 +1,50 @@ +--- +apiVersion: helm.cattle.io/v1 +kind: HelmChart +metadata: + name: argocd-apps + namespace: kube-system +spec: + # do not change order! (needed for renovate) + chart: argocd-apps + repo: https://argoproj.github.io/argo-helm + version: 2.0.0 + targetNamespace: argocd + valuesContent: |- + projects: + baseline: + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io + sourceRepos: + - '*' + destinations: + - namespace: '*' + server: '*' + clusterResourceWhitelist: + - group: '*' + kind: '*' + applications: + baseline: + project: baseline + finalizers: + - resources-finalizer.argocd.argoproj.io + source: + repoURL: 'https://git.smsvc.net/k8s/baseline.git' + targetRevision: HEAD + path: manifests/ + directory: + recurse: true + destination: + server: 'https://kubernetes.default.svc' + namespace: argocd + syncPolicy: + automated: + prune: true + selfHeal: true + retry: + limit: 5 + backoff: + duration: 5s + factor: 2 + maxDuration: 5m diff --git a/docker-compose.yml b/docker-compose.yml index 3fae818..7b7b411 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,20 @@ services: - k0s: - image: docker.io/k0sproject/k0s:v1.30.4-k0s.0 - command: k0s controller --config=/etc/k0s/config.yaml --enable-worker --no-taints - restart: always - stop_grace_period: 15s + k3s: + image: rancher/k3s:v1.30.4-k3s1 + command: + - server + - --disable=traefik + - --tls-san=k8s.smsvc.net hostname: k8s.smsvc.net + restart: always privileged: true cgroup: host network_mode: host volumes: - - k0s-data:/var/lib/k0s/ - - k0s-run:/run/ - - k0s-storage:/var/openebs/ - - k0s-run-udev:/run/udev - - ./k0s-config.yaml:/etc/k0s/config.yaml + - k3s-data:/var/lib/rancher/k3s/ + - k3s-run:/run/ + - ./argocd-init/:/var/lib/rancher/k3s/server/manifests/argocd-init/ volumes: - k0s-data: - k0s-run: - k0s-storage: - k0s-run-udev: + k3s-data: + k3s-run: diff --git a/k0s-config.yaml b/k0s-config.yaml deleted file mode 100644 index 6e15ae1..0000000 --- a/k0s-config.yaml +++ /dev/null @@ -1,97 +0,0 @@ ---- -apiVersion: k0s.k0sproject.io/v1beta1 -kind: ClusterConfig -metadata: - name: k0s -spec: - - api: - sans: - - k8s.smsvc.net - - telemetry: - enabled: false - - extensions: - helm: - repositories: - - name: argocd - url: https://argoproj.github.io/argo-helm - - name: metallb - url: https://metallb.github.io/metallb - - name: openebs-internal - url: https://openebs.github.io/charts - - charts: - - name: openebs - chartname: openebs-internal/openebs - version: 3.10.0 # depName=openebs repoUrl=https://openebs.github.io/charts - namespace: openebs - order: 0 - values: | - localprovisioner: - hostpathClass: - enabled: true - isDefaultClass: true - - - name: metallb - chartname: metallb/metallb - version: 0.14.8 # depName=metallb repoUrl=https://metallb.github.io/metallb - namespace: metallb - order: 0 - - - name: argocd - chartname: argocd/argo-cd - version: 7.5.0 # depName=argo-cd repoUrl=https://argoproj.github.io/argo-helm - namespace: argocd - order: 1 - values: | - applicationSet: - enabled: false - notifications: - enabled: false - dex: - enabled: false - - name: argocd-apps - chartname: argocd/argocd-apps - version: 2.0.0 # depName=argocd-apps repoUrl=https://argoproj.github.io/argo-helm - namespace: argocd - order: 2 - values: | - projects: - baseline: - namespace: argocd - finalizers: - - resources-finalizer.argocd.argoproj.io - sourceRepos: - - '*' - destinations: - - namespace: '*' - server: '*' - clusterResourceWhitelist: - - group: '*' - kind: '*' - applications: - baseline: - project: baseline - finalizers: - - resources-finalizer.argocd.argoproj.io - source: - repoURL: 'https://git.smsvc.net/k8s/baseline.git' - targetRevision: HEAD - path: manifests/ - directory: - recurse: true - destination: - server: 'https://kubernetes.default.svc' - namespace: argocd - syncPolicy: - automated: - prune: true - selfHeal: true - retry: - limit: 5 - backoff: - duration: 5s - factor: 2 - maxDuration: 5m diff --git a/manifests/metallb-address-pool.yml b/manifests/metallb-address-pool.yml deleted file mode 100644 index f23110a..0000000 --- a/manifests/metallb-address-pool.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: metallb.io/v1beta1 -kind: IPAddressPool -metadata: - name: metallb-address-pool - namespace: metallb - annotations: -spec: - addresses: - - 194.55.14.183/32