init k8s guide
This commit is contained in:
@ -187,20 +187,6 @@ spec:
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
Then create kustomization file:
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/flux-add-ons/kustomization.yaml" >}}
|
||||
|
||||
```yaml
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- sealed-secrets.yaml
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
{{< alert >}}
|
||||
Don't touch manifests under `flux-system` folder, as it's managed by Flux itself and overload on each flux bootstrap.
|
||||
{{< /alert >}}
|
||||
@ -226,18 +212,6 @@ It's now finally time to install some tools to help us in our CD journey.
|
||||
|
||||
A 1st good example is typically pgAdmin, which is a web UI for Postgres. We'll use it to manage our database cluster. It requires a local PVC to store its data user and settings.
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/postgres/kustomization.yaml" >}}
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deploy-pgadmin.yaml
|
||||
- sealed-secret-pgadmin.yaml
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/postgres/deploy-pgadmin.yaml" >}}
|
||||
|
||||
```yaml
|
||||
@ -370,19 +344,6 @@ It's time to use some useful apps.
|
||||
|
||||
Let's try some app that require a bit more configuration and real database connection with n8n, a workflow automation tool.
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/n8n/kustomization.yaml" >}}
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deploy-n8n.yaml
|
||||
- sealed-secret-n8n-db.yaml
|
||||
- sealed-secret-n8n-smtp.yaml
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/n8n/deploy-n8n.yaml" >}}
|
||||
|
||||
```yaml
|
||||
@ -548,20 +509,6 @@ Then don't forget to seal secrets and remove original files the same way as pgAd
|
||||
|
||||
Let's try a final candidate with NocoDB, an Airtable-like generator for Postgres. It's very similar to n8n.
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/nocodb/kustomization.yaml" >}}
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deploy-nocodb.yaml
|
||||
- sealed-secret-nocodb-db.yaml
|
||||
- sealed-secret-nocodb-auth.yaml
|
||||
- sealed-secret-nocodb-smtp.yaml
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/nocodb/deploy-nocodb.yaml" >}}
|
||||
|
||||
```yaml
|
||||
|
@ -210,51 +210,7 @@ This is exactly how it works, the `ServiceMonitor` custom resource is responsibl
|
||||
|
||||
### Monitoring Flux
|
||||
|
||||
There is one missing however, let's add monitoring for flux. Go back to flux project and push following manifests:
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/flux-add-ons/flux-monitoring.yaml" >}}
|
||||
|
||||
```yaml
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: flux-monitoring
|
||||
namespace: flux-system
|
||||
spec:
|
||||
interval: 30m0s
|
||||
ref:
|
||||
branch: main
|
||||
url: https://github.com/fluxcd/flux2
|
||||
---
|
||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: monitoring-config
|
||||
namespace: flux-system
|
||||
spec:
|
||||
interval: 1h0m0s
|
||||
path: ./manifests/monitoring/monitoring-config
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: flux-monitoring
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
The `spec.path` under `Kustomization` tells Flux to scrape [remote monitoring manifests](https://github.com/fluxcd/flux2/tree/main/manifests/monitoring/monitoring-config), avoiding us to write all of them manually. It includes the `PodMonitor` as well as Grafana dashboards.
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="clusters/demo/flux-add-ons/kustomization.yaml" >}}
|
||||
|
||||
```yaml
|
||||
# ...
|
||||
resources:
|
||||
# ...
|
||||
- flux-monitoring.yaml
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
TODO
|
||||
|
||||
After some minutes, flux should be appearing in Prometheus targets.
|
||||
|
||||
|
@ -307,9 +307,12 @@ You should be able to log in `https://gitea.kube.rocks` with chosen admin creden
|
||||
Let's generate a basic .NET Web API project. Create a new dotnet project like following (you may install [last .NET SDK](https://dotnet.microsoft.com/en-us/download)):
|
||||
|
||||
```sh
|
||||
dotnet new webapi --name KubeRocksDemo -o kuberocks-demo`
|
||||
mkdir kuberocks-demo
|
||||
cd kuberocks-demo
|
||||
dotnet new sln
|
||||
dotnet new gitignore
|
||||
dotnet new webapi -o src/KubeRocks.WebApi
|
||||
dotnet sln add src/KubeRocks.WebApi
|
||||
git init
|
||||
git add .
|
||||
git commit -m "first commit"
|
||||
@ -881,7 +884,7 @@ jobs:
|
||||
- |
|
||||
dotnet format --verify-no-changes
|
||||
dotnet build -c Release
|
||||
dotnet publish -c Release -o publish --no-restore --no-build
|
||||
dotnet publish src/KubeRocks.WebApi -c Release -o publish --no-restore --no-build
|
||||
|
||||
- task: build-image
|
||||
privileged: true
|
||||
@ -934,14 +937,64 @@ If everything is ok, check in `https://gitea.kube.rocks/admin/packages`, you sho
|
||||
|
||||
If you followed the previous parts of this tutorial, you should have clue about how to deploy our app. Let's create a new Helm chart for that:
|
||||
|
||||
{{< highlight host="demo-kube-flux" file="demo/aspnet.yaml" >}}
|
||||
{{< highlight host="demo-kube-flux" file="kuberocks/demo.yaml" >}}
|
||||
|
||||
```yaml
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: demo
|
||||
namespace: kuberocks
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: demo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dockerconfigjson
|
||||
containers:
|
||||
- name: api
|
||||
image: gitea.kube.okami101.io/kuberocks/demo:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: demo
|
||||
namespace: kuberocks
|
||||
spec:
|
||||
selector:
|
||||
app: demo
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: demo
|
||||
namespace: kuberocks
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- match: Host(`demo.kube.rocks`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: demo
|
||||
port: http
|
||||
```
|
||||
|
||||
{{< /highlight >}}
|
||||
|
||||
`https://demo.kube.rocks/WeatherForecast`
|
||||
|
||||
## 6th check ✅
|
||||
|
||||
We have everything we need for app building with automatic deployment ! Go [next part]({{< ref "/posts/15-build-your-own-kubernetes-cluster-part-6" >}}) for advanced tracing / load testing !
|
||||
|
Reference in New Issue
Block a user