| name | deploy-to-cluster |
| description | Deploy test builds to microk8s/kubeadm clusters using harbor.cloudnative.biz/tmp registry |
| allowed-tools | Bash |
Deploy to Cluster
Deploy test builds of bjorn2scan to non-Kind Kubernetes clusters for testing.
When to Use
- Testing changes on real clusters before release
- Debugging cluster-specific issues
- Validating fixes in production-like environments
Usage
/deploy-to-cluster <cluster-context> <tag>
Workflow
Step 1: Determine Target Architecture
Before building, check the target cluster's architecture:
kubectl --context <CONTEXT> get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeInfo.architecture}{"\n"}{end}'
Common architectures:
amd64 - x86_64 (Intel/AMD)
arm64 - ARM 64-bit (Apple Silicon, Raspberry Pi 4, etc.)
Step 2: Build Images for Target Architecture
For amd64 clusters:
docker buildx build --platform linux/amd64 \
-t harbor.cloudnative.biz/tmp/bjorn2scan-scan-server:<TAG> \
-f k8s-scan-server/Dockerfile --push .
docker buildx build --platform linux/amd64 \
-t harbor.cloudnative.biz/tmp/bjorn2scan-pod-scanner:<TAG> \
-f pod-scanner/Dockerfile --push .
For arm64 clusters:
docker buildx build --platform linux/arm64 \
-t harbor.cloudnative.biz/tmp/bjorn2scan-scan-server:<TAG> \
-f k8s-scan-server/Dockerfile --push .
docker buildx build --platform linux/arm64 \
-t harbor.cloudnative.biz/tmp/bjorn2scan-pod-scanner:<TAG> \
-f pod-scanner/Dockerfile --push .
For multi-arch (both):
docker buildx build --platform linux/amd64,linux/arm64 \
-t harbor.cloudnative.biz/tmp/bjorn2scan-scan-server:<TAG> \
-f k8s-scan-server/Dockerfile --push .
docker buildx build --platform linux/amd64,linux/arm64 \
-t harbor.cloudnative.biz/tmp/bjorn2scan-pod-scanner:<TAG> \
-f pod-scanner/Dockerfile --push .
Step 3: Deploy via Helm
helm upgrade bjorn2scan ./helm/bjorn2scan \
--kube-context <CONTEXT> \
--namespace <NAMESPACE> \
--set scanServer.image.repository=harbor.cloudnative.biz/tmp/bjorn2scan-scan-server \
--set scanServer.image.tag=<TAG> \
--set podScanner.image.repository=harbor.cloudnative.biz/tmp/bjorn2scan-pod-scanner \
--set podScanner.image.tag=<TAG> \
--reuse-values
Step 4: Verify Deployment
kubectl --context <CONTEXT> get pods -n <NAMESPACE> -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}'
kubectl --context <CONTEXT> get pods -n <NAMESPACE>
kubectl --context <CONTEXT> logs -n <NAMESPACE> deploy/bjorn2scan-scan-server --tail=50
Step 5: Get Service URL and Test
kubectl --context <CONTEXT> get svc -n <NAMESPACE> bjorn2scan-scan-server -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
kubectl --context <CONTEXT> get svc -n <NAMESPACE> bjorn2scan-scan-server -o jsonpath='{.spec.ports[0].nodePort}'
curl http://<URL>/health
curl http://<URL>/info | jq .version
Registry
Images are pushed to: harbor.cloudnative.biz/tmp/<image>:<tag>
This is a temporary registry for test builds.
Rollback
helm rollback bjorn2scan --kube-context <CONTEXT> --namespace <NAMESPACE>
helm upgrade bjorn2scan ./helm/bjorn2scan \
--kube-context <CONTEXT> \
--namespace <NAMESPACE> \
--reset-values
Troubleshooting
Image Pull Errors (wrong architecture)
If pods fail with exec format error or crash immediately:
- Check the image architecture:
docker manifest inspect harbor.cloudnative.biz/tmp/bjorn2scan-scan-server:<TAG>
- Verify it matches the cluster:
kubectl --context <CONTEXT> get nodes -o jsonpath='{.items[0].status.nodeInfo.architecture}'
- Rebuild with correct
--platform flag
ImagePullBackOff
- Check image exists:
docker manifest inspect harbor.cloudnative.biz/tmp/bjorn2scan-scan-server:<TAG>
- Check cluster can access registry
- Check image pull secrets if needed
Setting up buildx (if not available)
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap