Lesson 1: Configuring the Demo Application#
In this lesson you will import the project into your own GitLab namespace and — if you want to run the full DevSecOps workflow including DAST — deploy the application to a Kubernetes cluster.
This lesson covers:
- Importing this project to your workspace
- Installing the Kubernetes Gateway API on your cluster (optional — deployment only)
- Adding the Kubernetes cluster as a deploy target (optional — deployment only)
- Deploying the application (optional — deployment only)
Make sure you have the prerequisites listed on the project overview page before proceeding.
Not deploying? If you set the
SKIP_DEPLOYvariable as described on the project overview page, you can skip the Kubernetes and deployment sections below and proceed directly to Lesson 2. Static scanners (SAST, Dependency Scanning, Container Scanning, Secret Detection, IaC Scanning) all work without a deployed application.
Import this project to your workspace#
First, we will import the Tanuki Shop project into your own GitLab namespace so you have full control over it.
Log in to GitLab.com
On the left sidebar, click Projects (or navigate directly to https://gitlab.com/projects/new)
Select Import project
Click the Repository by URL button
Under Git repository URL, enter the following:
https://gitlab.com/gitlab-da/tutorials/security-and-governance/tanuki-shop.gitUnder Project URL, select the group or namespace where you have a GitLab Ultimate license
Under Visibility Level, select Public
Visibility is set to Public so the Kubernetes cluster can pull container images from the project’s container registry without extra authentication. If you are not deploying, Private is fine.
Click Create project
Wait for the import to complete. After a few seconds you will be redirected to the newly imported project with the message The project was successfully imported.
Install the Kubernetes Gateway API on your cluster#
Deployment only — skip this section if you set
SKIP_DEPLOY=true.
To access the deployed application, we use the Kubernetes Gateway API — the successor to the older Ingress API, with a more expressive, role-oriented model for traffic routing. See the migration guide for the trade-offs.
- Connect to your Kubernetes cluster
gcloud container clusters get-credentials $YOUR_CLUSTER --zone $YOUR_ZONE --project $YOUR_PROJECT- Install the Gateway API Custom Resource Definitions (CRDs)
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/latest/download/standard-install.yaml- Verify the Gateway API CRDs are installed
kubectl get crds | grep gatewayYou should see CRDs such as gateways.gateway.networking.k8s.io, httproutes.gateway.networking.k8s.io, and gatewayclasses.gateway.networking.k8s.io.
- Verify that a GatewayClass is available
kubectl get gatewayclassYou should see one or more GatewayClass resources from your cluster’s built-in Gateway controller. On GKE you will see classes like gke-l7-global-external-managed.
Most managed Kubernetes platforms (GKE, EKS, AKS) ship with a built-in Gateway API controller. If yours does not, install any conformant implementation (Istio, Cilium, NGINX Gateway Fabric, etc.).
- In your imported project, update the
gatewayClassNameinchart/values.yamlto match the GatewayClass name from the previous step
gateway:
gatewayClassName: "gke-l7-global-external-managed" # replace with your GatewayClass nameAdding the Kubernetes cluster as a deploy target#
Deployment only — skip this section if you set
SKIP_DEPLOY=true.
In this section we will install the GitLab Agent for Kubernetes onto your cluster. The agent is the trusted channel between GitLab and your cluster — it lets GitLab deploy applications, run DAST scans against them, and (optionally) scan the cluster itself for misconfigurations.
In your project, navigate to Operate > Kubernetes clusters in the left sidebar
Click Connect a cluster (agent)
In the dialog, under Option 2: Create and register an agent with the UI, type tanuki as the agent name and click Create and register
Open a terminal and connect to your cluster (if not already connected)
gcloud container clusters get-credentials $YOUR_CLUSTER --zone $YOUR_ZONE --project $YOUR_PROJECT- Copy and paste the Helm command displayed in the GitLab UI into your terminal. It will look similar to this (with the token already filled in):
helm repo add gitlab https://charts.gitlab.io
helm repo update
helm upgrade --install tanuki gitlab/gitlab-agent \
--namespace gitlab-agent-tanuki \
--create-namespace \
--set config.token=$YOUR_TOKEN_HERE \
--set config.kasAddress=wss://kas.gitlab.comThe
$YOUR_TOKEN_HEREvalue is unique to your agent registration. Use the exact command from the GitLab UI, which has the token pre-filled.
- Verify the agent pod is running
kubectl get pods -n gitlab-agent-tanukiYou should see a pod with a status of Running.
Deploying the application#
Deployment only — skip this section if you set
SKIP_DEPLOY=true.
Now let’s trigger a pipeline to build and deploy the application to your Kubernetes cluster.
In your project, navigate to Build > Pipelines in the left sidebar
Click Run pipeline
Ensure the main branch is selected
Click Run pipeline. The page will refresh and the pipeline will start.
Wait for the pipeline to complete. You can watch the progress of each job by clicking on the pipeline.
Once the pipeline succeeds, navigate to Operate > Environments in the left sidebar
Find the tanuki-gitlab environment and click Open to view the deployed application. The Tanuki Shop storefront should load in a new browser tab.
The project is now imported (and, if you chose to, deployed). Next we’ll configure security scanners and policies.