netflux-kubernetes/README.md

97 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2022-05-05 15:42:34 +00:00
# Netflux on Kubernetes
2023-09-10 12:40:42 +00:00
This repo contains Kubernetes manifests for deploying various self-hosted
services to the `netflux.io` domain.
2022-05-05 20:51:11 +00:00
2023-09-12 06:51:16 +00:00
![Me deploying my blog on Kubernetes. Credit @dexhorthy](https://git.netflux.io/rob/netflux-kubernetes/raw/branch/main/picture.jpg)
2022-05-05 20:51:11 +00:00
2023-09-10 12:40:42 +00:00
All of the manifests are built using [Kustomize](https://kustomize.io/). I
avoid Helm charts whenever possible, but when they're needed (Prometheus,
Grafana, etc) the charts are inflated into this repository for visibility and
auditability.
The manifests are deployed to a DigitalOcean managed k8s cluster in production,
and can be easily applied to a local cluster for testing and development.
Of course all this would in many ways be simpler with a docker-compose.yml
shipped to a virtual host, which is exactly how everything used to be deployed.
This project is mostly a fun learning exercise.
## Git
The main git repo is hosted at: https://git.netflux.io/rob/netflux-kubernetes
It is also mirrored on GitHub: https://github.com/rfwatson/netflux-kubernetes
2022-05-05 20:51:11 +00:00
## Building
The manifests can be built with:
```
make dev
```
and applied with:
```
make dev | kubectl apply -f -
```
2023-09-10 12:40:42 +00:00
## Linting
The manifests are linted with [kube-linter](https://docs.kubelinter.io):
```
kube-linter lint .
```
## Helm charts
2023-09-12 06:51:16 +00:00
When required, Helm charts can be inflated with:
```
# install or update the prometheus helm chart:
make inflate name=prometheus chart=prometheus-community/prometheus
```
2023-09-10 12:40:42 +00:00
An optional values file can be provided, e.g. `deploy/base/values/prometheus.yaml`.
2023-09-10 12:40:42 +00:00
## URLs
URLs to some of the deployed services:
2022-05-05 15:42:34 +00:00
2023-09-10 12:40:42 +00:00
* [git.netflux.io](https://git.netflux.io)
* [tube.netflux.io](https://tube.netflux.io)
* [element.netflux.io](https://element.netflux.io)
2022-05-05 15:42:34 +00:00
2023-09-10 12:40:42 +00:00
## Cluster setup
2022-05-05 15:42:34 +00:00
2023-09-10 12:40:42 +00:00
### Development
2022-05-05 15:42:34 +00:00
2023-09-10 12:40:42 +00:00
To initialize the local PostgreSQL database:
2022-05-05 15:42:34 +00:00
```
2023-09-10 12:40:42 +00:00
# Ensure PostgreSQL helm chart is installed (only used in development env):
cd deploy
make dev | k apply -l app.kubernetes.io/name=postgresql -f -
2022-05-05 15:42:34 +00:00
2023-09-10 12:40:42 +00:00
kubectl port-forward dev-postgresql-0 5432
psql -h localhost -f ../kind/bin/setup-dev-db.sql
```
2023-03-21 01:37:42 +00:00
2024-01-13 12:10:53 +00:00
To connect locally to the Nginx ingress controller:
```
sudo -E kubectl port-forward dev-ingress-nginx-controller-abcdef1234-ab123 80:80 443:443 22:22
```
2024-01-13 13:17:45 +00:00
Or
```
sudo -E kubectl port-forward $(kubectl get pods | grep "dev-ingress-nginx-controller.*Running" | awk '{print $1}') 80:80 443:443 22:22
```
2023-09-10 12:40:42 +00:00
### Additional dependencies
2023-03-21 01:37:42 +00:00
2023-09-10 12:40:42 +00:00
- envfilesubst [link](https://git.netflux.io/rob/envfilesubst)