Test your Application in the Kubernetes Setup on the Google Cloud Platform
Prerequisites
- Google Cloud account with a project and cluster
- Google Cloud SDK
- Kubectl
Procedure
-
From a terminal execute the following commands:
gcloud auth login
gcloud config set project <your project name>
gcloud config set container/cluster <your cluster name>
gcloud container clusters get-credentials <your cluster name> --zone <your cluster zone name name>
kubectl get nodes
-
Tag the application image created in the previous step.
docker tag bwce-http-reqresp-app gcr.io/<your project name>/bwce-http-reqresp-app
-
Push your application image to Google Container Registry.
gcloud docker push gcr.io/<your project name>/bwce-http-reqresp-app
-
Confirm that the image is present in the Google Container Registry.
-
Open the
manifest.yml file and update the application image name. Ensure the image name follows the format
gcr.io/<your gcloud project name>/<image name>
-
Navigate to the samples directory where the manifest file is present and execute the following command to create the service:
kubectl create -f manifest.yml
-
To check that application has started successfully, type in below command
-
After few minutes, the external IP will be available. Check it using the following command:
kubectl get service bwce-http-requestreply-service
-
Edit the
request_news.html
file, replace the URL
http://127.0.0.1:8080 with the external IP address, and save the file
-
Open the
request_news.html file in a web browser
-
Click the
Get News from Wiki! button to request headlines from the associated web page.
Copyright © Cloud Software Group, Inc. All rights reserved.