The k3d cluster will run
in
your Codespace - no need for an external cluster
- Use
kic
to create and verify a new k3d cluster
# delete and create a new cluster
kic cluster create
# wait for pods to get to Running
kic pods --watch
You can skip this step if you already created MyApp
- PiB includes templates for new applications that encapsulate K8s best practices
- For the Workshop, use
MyApp
for the application name - You can use any app name that conforms to a dotnet namespace
- PascalCase
- alpha only
- <= 20 chars
- For the Workshop, use
- Once created, you can browse the code in the Explorer window
# create a new app from the dotnet web api template
cd apps
kic new dotnet-webapi MyApp
# this is important as the CLI is "context aware"
cd myapp
Make sure you are in the apps/myapp directory
- Now that we've created a new application, the next logical step is to
build
the app - PiB encapsulates many best practices, so, as an App Dev, you don't have to figure out how to build a secure, multi-stage Dockerfile
# build the app
kic build all
# view docker images
docker images
Notice you don't have to create or edit K8s YAML files!
- This deploys
- Flux
- MyApp
- Fluent Bit
- Grafana
- Prometheus
- WebValidate (more on this later)
# deploy flux to the cluster
kic cluster flux-install
# wait for pods to start
kic pods --watch
# check flux
kic check flux
- After making changes, you can force Flux to sync (reconcile)
kic sync
- The Flux setup yaml is located in
apps/myapp/kic-deploy/flux
- A
Flux source
is a git repo / branch combination - A
Flux kustomization
is a directory within the source- We have 3 kustomizations
- kustomization-flux watches the flux directory
- kustomization-app watches the app directory
- kustomization-monitoring watches the monitoring directory
- You want to have multiple kustomizations (or helm)
- When a kustomization fails, the entire process is aborted
- This lets "your app" break "my app"
- We generally create a kustomization per namespace for production
- Our GitOps Automation (outer-loop) automatically creates a kustomization per namespace
- When a kustomization fails, the entire process is aborted
- We have 3 kustomizations
- A
- View the flux setup script by running
kic cluster flux-install --show
- Use the inner-loop instructions to further test the deployment