website/content/lab-notes/k8s.md
2025-07-20 23:23:39 -04:00

134 lines
2.8 KiB
Markdown
Executable file

---
title: Mira's attempts to understand Kuwubernetes
date: 2025-04-07
---
# Install k3s, helm
- run `curl -sfL https://get.k3s.io | sh - on first node
- `curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash`
`export KUBECONFIG=/etc/rancher/k3s/k3s.yaml`
```yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: adminer
name: adminer
spec:
replicas: 1
selector:
matchLabels:
app: adminer
template:
metadata:
labels:
app: adminer
spec:
containers:
- image: adminer:latest
name: adminer
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: adminer-svc
spec:
type: ClusterIP
selector:
app: adminer
ports:
- port: 8080
targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: adminer-http
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
rules:
- host: adminer.lipotropin.lan
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: adminer-svc
port:
number: 8080
```
- Use `kubectl apply -f <yaml>` to deploy a yaml file
The above two result in the following
```
$ kubectl describe svc
Name: adminer
Namespace: default
Labels: io.kompose.service=adminer
Annotations: <none>
Selector: io.kompose.service=adminer
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.43.229.81
IPs: 10.43.229.81
Port: 8090 8090/TCP
TargetPort: 8080/TCP
Endpoints: 10.42.0.10:8080
Session Affinity: None
Internal Traffic Policy: Cluster
Events: <none>
```
Adminer can be accesed at `10.42.0.10:8080`
> [!TODO] how tf do I access this from 127.0.0.1 or outside?
---
- Deployment: seems to translate to docker service
- Service: seems to handle connecting to the deployment?
- NodePort: something to do with routing
- `kubectl expose deployment <deployment_name> --port=<port> --target-port=<target_port> --type=NodePort`
`kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml`
`export KUBECONFIG=/etc/rancher/k3s/k3s.yaml`
---
# TODO:
- [x] cyberchef
- [x] adminer
- [x] soulseek
- [x] postgres
- [x] mariadb
- [x] Ntfy
- [x] gluetun?
- [x] Jackett
- [x] qbittorrent
- [x] radarr
- [ ] sonarr
- [ ] syncthing
- [ ] forgejo
- [ ] kuma
- [ ] paperless-ngx
- [ ] goternberg
- [ ] redis
- [ ] tika
- [ ] jellyfin
- [ ] Website
- [ ] crowdsec
- [ ] dufs
- [ ] minecraft
- [ ] flaresolverr?