This document explains how to build and run Unguard locally inside Kubernetes using skaffold
.
Warning: Most of the services rely on the Kubernetes DNS. If you must deploy some parts of the application without a Kubernetes cluster, read the READMEs of the individual services instead.
- Docker
- Kubectl, Helm, Skaffold CLI v2, and Kustomize
- Kind, or, alternatively Minikube
- For best performance and stability, we recommend Kind, especially on Windows
-
Launch a local Kubernetes cluster
-
Launch a
kind
cluster with extraPortMappings for the local ingresskind create cluster --name unguard --config ./k8s-manifests/localdev/kind/cluster-config.yaml
- Also, make sure to deploy an nginx ingress controller so that Unguard can be exposed locally (without port-forwarding)
kubectl apply -k ./k8s-manifests/localdev/kind/
- Also, make sure to deploy an nginx ingress controller so that Unguard can be exposed locally (without port-forwarding)
-
Or, launch a
minikube
cluster with the ingress addonminikube start --addons=ingress --profile unguard
-
-
Run
kubectl get nodes
to verify the connection to the respective control plane
-
Use
skaffold
to build and deploy the application. The first full build will take up to 20 minutes. If the images should be rebuilt automatically, runskaffold dev
.skaffold run
-
Add an entry in your
/etc/hosts
file to access the ingress exposing the frontend on unguard.kube- For kind clusters, append this to
/etc/hosts
:
127.0.0.1 unguard.kube
- For minikube clusters, execute this in your shell or manually add the output of
minikube -p unguard ip
to your/etc/hosts
file
sudo -- sh -c "echo $(minikube -p unguard ip) unguard.kube >> /etc/hosts"
- For kind clusters, append this to
Run skaffold delete
with the chosen profile used to start unguard to clean up the deployed resources.
skaffold delete [-p <profile>]
Have a look at the profiles that are supported in skaffold.yaml
.
If you want to enable tracing use the tracing
profile. See these instructions
skaffold run -p tracing
To benefit from incremental Java builds in the container, install OpenJDK 11 and Jib.
You may then append the jib
profile which adapts the build section so that it uses your locally installed Jib.
skaffold run -p jib
Clusters are configured in ~/.kube/config
.
To switch between different clusters (e.g., between aws
and kind
) set the current-context:
to a cluster saved in
the contexts:
section.
A great tool that makes this process faster is kubectx.
Maybe you find something in the other FAQ document.
-
Skaffold did not detect the running minikube:
Skaffold normally detects reliably a running minikube and should adapt automatically, if not forwarding minikubes's docker daemon might help:
For more information see :https://skaffold.dev/docs/environment/local-cluster/#auto-detection
# on 🐧 Linux eval $(minikube -p unguard docker-env) # on 🍎 macOS source <(minikube docker-env -p unguard) # on 💻 Windows with PowerShell & minikube -p unguard docker-env | Invoke-Expression
Copyright 2023 Dynatrace LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.