Getting Started with Google Container Builder – Part 4

November 20, 2017

Note: This is the fourth part in a series of posts Getting Started with Google Container Builder


Configure CD to Kubernetes

In this part we will configure the build to deploy the application to our Kubernetes cluster after each commit (CD).


• Add a new kubectl step in the cloudbuild.yaml file to replace the image used by kubernetes to run the application:

- name: ''
  args: ['install']
- name: ''
  args: [ 'build', '-t', '$PROJECT_ID/sdp-demo-app:$SHORT_SHA', '.' ]
- name: ''
  args: ['set', 'image', 'deployment/demo-app', '$PROJECT_ID/sdp-demo-app:$SHORT_SHA']
  - 'CLOUDSDK_COMPUTE_ZONE=europe-west1-c'
- '$PROJECT_ID/sdp-demo-app'
- 'demo'
- 'nodejs'


• Change the application message to test that the CD is working. For this edit the get main function in the “server.js” file to change the message from Hello World! to Hello New World!:

var express = require('express');
var app = express();
var port = 3000;
var primes = require('./primes.js');

app.get('/', function(req, res){
    res.status(200).send('Hello New World!');

app.get('/isPrime/:number', function(req, res){

exports.stop = function(){
var server = app.listen(port, function(){
  console.log("Express server listening on port %d in %s mode", port, app.settings.env);


• After commit and push the changes a new build should be triggered in the build history view:



• Wait for the build to finish and then browse to the application page



Continue with: Getting Started with Google Container Builder – Part 5


Add comment
facebook linkedin twitter email

Leave a Reply