GOOGLE CLOUD - KUBERNETES -
DOCKER - CONTINUOUS
DEPLOYMENT - JENKINS - SPRING
BOOT - MAVEN - MICROSERVICES
JAMES HEGGS
SETTING THE SCENE…
ABOUT ME @EGGSY84
▸Software Developer - Bespoke software house
▸Software Developer - SaaS product based
▸Head of Operations - Config/Orchestration/Deploys etc
▸Co-Organiser DevOps Manchester Meetup
▸DevOps Consultant - GDS project
▸Head of Development - ResponseTap
SETTING THE SCENE…
THIS TALK
▸WILL:
▸Provide high level view of technologies
▸Share code examples and walkthroughs
▸WILL NOT:
▸Cover why you would do this
▸Whether you even should do this
OPERATIONS
INFRASTRUCTURE
OPERATIONS
GOOGLE CLOUD PLATFORM (GCP)
▸Utilises Google Container Engine (GKE)
▸(which is actually just Kubernetes)
▸Projects and Operations within them
▸Found GKE learning curve less steep than EC2 container
service
OPERATIONS
JENKINS MASTER
▸https://github.com/eggsy84/gcp-jenkins-master-k8s-seed
▸Built with Docker and available on public Docker hub
▸Utilises Jenkins pipeline plugin for pipelines as code
▸Utilises Jenkins Kubernetes (k8s) plugin for communication
with k8s API
OPERATIONS
JENKINS SLAVE
▸https://github.com/eggsy84/gcp-jenkins-slave-k8s-seed
▸Built with Docker and available on public Docker hub
▸Spun up as Docker containers by k8s plugin
▸Installs required build tools (maven, docker, gcloud tools)
OPERATIONS
BOOTSTRAP SCRIPT
▸https://github.com/eggsy84/gcp-bootstrap-infrastructure
▸Will create GKE cluster in specified zone, under specified
project with specified number of nodes called “cd-cluster”
▸Uses k8s YAML files to deploy jenkins master
sh deploy.sh {project_name} {zone} {machine-type} {number-of-nodes} {service-
account-file.json}
sh deploy.sh docker-meetup europe-west1-b n1-standard-2 1 ~/srvc-account.json
DEVELOPMENT
CODE AND PIPELINES
DEVELOPMENT
SPRING BOOT JAVA APP
▸https://github.com/eggsy84/gcp-spring-boot-app
▸Really simple maven based spring boot app
▸mvn spring-boot:run
DEVELOPMENT
JENKINSFILE
▸https://github.com/eggsy84/gcp-spring-boot-
app/blob/master/Jenkinsfile
▸Part of the source control for the application
▸Uses Jenkins pipeline DSL to define build stages
▸Node name relates to the node name defined in the k8s
plugin
▸Produces docker build tagged with build date time
DEVELOPMENT
JENKINSFILE
node('build-slave') {
// Project name will be passed in as a parameter
def project = "${GCP_PROJECT_NAME}"
def appName = 'spring-boot-app'
// BUILD_DATE_TIME defined as a build parameter in Jenkins
def imageTag = "eu.gcr.io/${project}/${appName}:${BUILD_DATE_TIME}"
// Code checkout stage
stage 'Checkout'
checkout scm
// Compile with maven stage
stage 'Compile'
sh "mvn clean compile”
. . .
DEVELOPMENT
K8S FILES
▸https://github.com/eggsy84/gcp-spring-boot-
app/tree/master/k8s/deployments
▸https://github.com/eggsy84/gcp-spring-boot-
app/tree/master/k8s/services
▸Executes kubernetes deployments and services for
presenting application externally
DEVELOPMENT
K8S DEPLOYMENT
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: app-deployment
spec:
replicas: 1
template:
metadata:
name: spring-boot-app
labels:
name: spring-boot-app
spec:
containers:
- name: spring-boot-app
image: eu.gcr.io/GCP_PROJECT/APP_NAME:1.0.0
imagePullPolicy: Always
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 10
timeoutSeconds: 5
ports:
- name: app-http
containerPort: 8080
DEVELOPMENT
K8S SERVICE
apiVersion: v1
kind: Service
metadata:
name: app-service
labels:
app: app-service
spec:
type: LoadBalancer
ports:
- port: 80
name: frontend-http
targetPort: 8080
protocol: TCP
selector:
name: spring-boot-app
DEMO TIME
PROMISES
COMING SOON…
▸As well as the open source code I will get round to putting a
blog together - promise :)
▸Slides will go up on slideshare
▸Code will get README’s and instructions
ANY
QUESTIONS?
THANK YOU FOR LISTENING
WRAP UP
USEFUL LINKS
▸https://github.com/search?q=user%3Aeggsy84+gcp
▸https://hub.docker.com/r/eggsy84/gcp-jenkins-slave-k8s-
seed/
▸https://hub.docker.com/r/eggsy84/gcp-jenkins-master-k8s-
seed/
WRAP UP
USEFUL LINKS
▸https://wiki.jenkins-
ci.org/display/JENKINS/Kubernetes+Plugin
▸https://jenkins.io/doc/pipeline/
▸https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin
▸https://github.com/GoogleCloudPlatform/continuous-
deployment-on-kubernetes

Zero to Continuous Delivery on Google Cloud

Editor's Notes

  • #2 This talk is buzzword central and I wasn’t sure what to actually call it. So I just thought stuff it I’ll buzzword the hell out of the subject. On the plus side I’m sure it’ll lead to lots of attention on LinkedIn…
  • #3 Hello everyone I’m James Heggs Thought I’d start by setting a bit of context around my background. I started out as a Software Developer working at a bespoke software house - largely on web based Java environments. Moved to a SaaS based business as their first full time employee and only dev. Trained on the job through that organisation transitioned to Tech Lead/Dev Lead, then on to Head of Operations focusing on Config/Orchestration/Deploys etc. It was at this stage when our processes and practices were in need of investment that I discovered DevOps - around 4 years ago. I organised an continue to organise the community DevOps Manchester meetup. Left that role and became a DevOps Consultant working on a GDS based project Up to present day I’m currently Head of a Development team focusing on CALMS and empowerment!
  • #7 GKE is essentially Kubernetes
  • #8 Kubernetes services and pods
  • #9 Java Network Launch Protocol
  • #10 Java Network Launch Protocol
  • #17 Notice how we use sed in the jenkinsfile to swap out the tagged docker image
  • #18 Sets type as LoadBalancer which tells GKE to expose the IP address and port externally