Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(k8s): create PoC for k3s in k8s #36

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ secret*.yaml

# Built binary files.
bin/

# Ignore kubeconfig files.
kubeconfig*.yaml
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,16 @@ docker:
--build-arg TARGET=$(TARGET) \
--build-arg VERSION=$(VERSION) \
-f build/package/Dockerfile .

.PHONY: inception-up
inception-up:
kubectl -n inception apply -f configs/inception/inception.yaml
kubectl -n inception wait --for=condition=Ready pod -l app.kubernetes.io/name=k3s-poc
kubectl -n inception get pods -l app.kubernetes.io/name=k3s-poc -o jsonpath='{.items[0].metadata.name}'
kubectl -n inception cp $$(kubectl -n inception get pods -l app.kubernetes.io/name=k3s-poc -o jsonpath='{.items[0].metadata.name}'):/etc/rancher/k3s/k3s.yaml kubeconfig.yaml
sed -i "s/127.0.0.1/k3s-poc.moos.nicklasfrahm.dev/" kubeconfig.yaml

.PHONY: inception-down
inception-down:
rm kubeconfig.yaml || true
kubectl delete -f configs/inception/inception.yaml
83 changes: 83 additions & 0 deletions configs/inception/inception.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
kind: Namespace
metadata:
name: inception
labels:
app.kubernetes.io/name: k3s-poc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: k3s-poc
namespace: inception
labels:
app.kubernetes.io/name: k3s-poc
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: k3s-poc
template:
metadata:
labels:
app.kubernetes.io/name: k3s-poc
spec:
containers:
- name: k3s
image: rancher/k3s:v1.28.2-k3s1
command:
- /bin/sh
args:
- -c
- |
/bin/k3s server \
--disable-agent \
--tls-san k3s-poc.moos.nicklasfrahm.dev \
--https-listen-port 443 \
&& true
imagePullPolicy: Always
ports:
- name: https
containerPort: 443
resources:
requests:
cpu: 1000m
memory: 1000Mi
limits:
cpu: 1000m
memory: 1000Mi
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: k3s-poc
namespace: inception
labels:
app.kubernetes.io/name: k3s-poc
spec:
type: ClusterIP
ports:
- name: https
port: 443
targetPort: 443
selector:
app.kubernetes.io/name: k3s-poc
---
apiVersion: traefik.io/v1alpha1
kind: IngressRouteTCP
metadata:
name: k3s-poc
namespace: inception
labels:
app.kubernetes.io/name: k3s-poc
spec:
entryPoints:
- websecure
routes:
- match: HostSNI(`k3s-poc.moos.nicklasfrahm.dev`)
services:
- name: k3s-poc
port: 443
tls:
passthrough: true