Deploying WebGoat on Google Cloud

Here are the instructions on how to deploy and run WebGoat on a Kubernetes container service in the Google Cloud.

You are expected to have an account at Google Cloud Platform and have configured a Kubernetes service cluster. And also have the proper Google Cloud and Kubernetes Command Line Tools installed.

Step 1 – Login to your Google Cloud

gcloud auth login

Step 2 – Select the desired project resource

gcloud config set project your-project-id

Step 3 – Pull the WebGoat docker image

docker pull webgoat/goatandwolf

Step 4 – Tag the WebGoat docker image and push it to the Cloud Container Registry

docker image tag webgoat/goatandwolf 
docker push

Step 5 – Set the correct Kubernetes environment

gcloud container clusters get-credentials your-cluster-id --zone your-zone-id

Step 6 – Deploy the container on the Kubernetes cluster

kubectl run mygoat --env TZ=Europe/Amsterdam

Step 7 – Expose the external IP to the service

kubectl expose deployment/mygoat --type="LoadBalancer" --port=8080,9090 
kubectl expose deployment/mygoat --name=nginx --type="LoadBalancer" --target-port=8888 --port=80
kubectl get service nginx --watch
#look to see which external ip is assigned

Step 8 – Run WebGoat and WebWolf

WebGoat is available at: http://someip:8080/WebGoat

WebWolf is available at: http://someip:9090/WebWolf

Or both via http://www.webgoat.local/

where http://www.weboat.local is pointing to the external ip address assigned to the nginx service.