Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

Google Cloud Platform Solutions

for DevOps Engineers


Márton Kodok / @martonkodok
Google Developer Expert at REEA.net - Targu Mures

March 2019 - Vilnius, Lithuania


About me
● Geek. Hiker. Do-er.
● Among the Top3 romanians on Stackoverflow 130k reputation
● Google Developer Expert on Cloud technologies
● Crafting Web/Mobile backends at REEA.net
● BigQuery/Redis and database engine expert
● Active in mentoring and IT community

StackOverflow: pentium10
GitHub: pentium10
Slideshare: martonkodok
Twitter: @martonkodok

GCP Solutions for DevOps Engineers @martonkodok


Agenda
1. Application development in the Cloud
2. App Engine: Scale your apps seamlessly from zero to planet scale
3. Cloud Functions: your gateway to GCP Services
4. Google Stackdriver: Metrics, logging, alerting are a universal right!
5. BigQuery: federated data access warehouse
6. Doing hybrid cloud mixing on premise with cloud
7. Practical use cases
8. Qwiklabs

GCP Solutions for DevOps Engineers @martonkodok


What’s so hard about traditional app development?

Select Containerization Monitoring Testing


IaaS

Networking Storage

Dev OS User
Setup Logging

Container
Orchestration

GCP Solutions for DevOps Engineers @martonkodok


REEA.net uses GCP
Build on the same infrastructure
that powers Google
Google Cloud Platform (GCP)
Compute Big Data Identity & Security

Compute App Kubernetes Cloud Cloud Cloud Cloud Resource Cloud Security Key
Engine Engine Engine BigQuery Cloud IAM
Dataflow Dataproc Dataprep Manager Scanner Management
Service

Cloud Container- Cloud Cloud Data Data Loss Identity-Aware Security Key
GPU Genomics BeyondCorp
Functions Optimized OS Datalab Pub/Sub Studio Prevention API Proxy Enforcement

Internet of Things Machine Learning Storage & Databases

Cloud IoT Cloud Machine Cloud Cloud Cloud Video Cloud Cloud Cloud Transfer
Core Learning Vision API Speech API Intelligence Storage Bigtable Datastore Appliance
API

Cloud Natural Cloud Cloud Advanced Cloud Persistent


Cloud SQL
Language API Translation Jobs API Solutions Lab Spanner Disk
API
Google Cloud Platform (GCP)
Management Tools Networking

Error Virtual Cloud Load Cloud Cloud Cloud Cloud


Stackdriver Monitoring Logging Trace
Reporting Private Cloud Balancing CDN External IP Firewall Rules Router
Addresses

Cloud Cloud Cloud Cloud Cloud Cloud Cloud Dedicated


Debugger Cloud DNS Cloud VPN
Deployment APIs Console Shell Interconnect Network Routes Interconnect
Manager

Developer Tools

Cloud Mobile Cloud


Profiler
App Billing API

Cloud Cloud Source Cloud Cloud Tools Container


Cloud SDK
Deployment Repositories Tools for for IntelliJ Builder
Manager Android Studio

Cloud Cloud Container Google Plug-in Cloud Test


Tools for Tools for Registry for Eclipse Lab
PowerShell Visual Studio
Google sees serverless as

Programming model Operational model Billing model

Focus on code Zero ops Pay for usage


Event-driven Automatic scaling
Stateless Managed security

Dev Ops $

GCP Solutions for DevOps Engineers @martonkodok


Serverless is more than a set of functions

BigQuery Cloud Storage

Cloud Dataflow Cloud Tasks


Cloud Functions App Engine

Stackdriver Cloud PubSub

GCP Solutions for DevOps Engineers @martonkodok


Meet Serverless

serverless data center depicted

GCP Solutions for DevOps Engineers @martonkodok


Serverless is about maximizing elasticity, cost
savings, and agility of cloud computing.

GCP Solutions for DevOps Engineers @martonkodok


Serverless types

Platforms Triggered Code

GCP Solutions for DevOps Engineers @martonkodok


App Engine - managed application platform

API 1
● Scale your applications seamlessly from
Multiple
Clients
App Engine zero to planet scale
API Requests Split App Versions
● Automatically scales depending on your
application traffic
API 2
Cloud Load Compute Engine ● Traffic Splitting (app versions, A/B tests,
Balancing
Virtual Machines incremental rollouts)

API 3
Container Engine

Kubernetes Services
Best used:
● For HTTP services
● For existing applications

GCP Solutions for DevOps Engineers @martonkodok


App Engine: Services and versions

Application

Service Service

Version Version Version Version

Instance Instance Instance Instance

GCP Solutions for DevOps Engineers @martonkodok


App Engine: Traffic splitting

A/B testing and


Canary releasing
with a few clicks or
a single gcloud
command

GCP Solutions for DevOps Engineers @martonkodok


App Engine: Runtimes

Java 8 1.11

GCP Solutions for DevOps Engineers @martonkodok


Async message processing

GCP Solutions for DevOps Engineers @martonkodok


Asynchronous task execution

Cloud Tasks Cloud PubSub

Message queue system Deliver event data based on topics


Guaranteed at-least-once delivery Exactly-once processing
Future Scheduling Build multi-cloud on premise, hybrid apps
Will only be dispatched once on dups Cross zone message replication

Best used: Best used:


● For HTTP services ● For large-scale ingestion of events, streams
● For App Engine handlers ● Topics, publish/subscribe patterns, IoT

GCP Solutions for DevOps Engineers @martonkodok


Cloud Tasks - Message Queue systems

Static Content
Cloud Storage

Dynamic Content
Front End App Cloud SQL Batch App
Cloud Load App Engine App Engine
Balancing
Autoscaling
Dynamic Content Autoscaling
Cloud Datastore

Memcache
Cloud
DNS
Workers
Workers
Cloud Compute Engine
Compute Engine
Tasks
Autoscaling

GCP Solutions for DevOps Engineers @martonkodok


Task Queues
Push queues
● Put with delays

Pull queues
● Ability to “tag”
● Lease multiple eg: gameboard
updated, game id as tag.

Slides: https://www.slideshare.net/martonkodok
Title: Architectural Patterns - Message Queues
GCP Solutions for DevOps Engineers @martonkodok
Reduce request latency

GCP Solutions for DevOps Engineers @martonkodok


Cloud Functions

GCP Solutions for DevOps Engineers @martonkodok


Cloud Functions

Triggered Code
Frontend
Platform Services

Event Cloud
Event Sourcing Application Result
Triggered Functions

Metrics / Logs/
Streaming

GCP Solutions for DevOps Engineers @martonkodok


Cloud Functions

Unit: Function
Trigger: Events and HTTP

Best used:
● For Events & Async workloads
● For single-purpose microservices

GCP Solutions for DevOps Engineers @martonkodok


Cloud Functions - Event-driven - FaaS
● Simplest way to run your code in the cloud - just deploy
● Automatically scales, highly available and fault tolerant
● No servers to provision, manage, patch or update
● Pay only while your code runs
● Connects and extends cloud services (In alpha: Java)

● Node 8.11 ● Python 3.7.1 ● Go 1.11


● Support for async/await ● Flask microframework ● Familiar building blocks

GCP Solutions for DevOps Engineers @martonkodok


Functions: your gateway to GCP Services
Access 20+ Google services from GCF

Services
Cloud Cloud Cloud Cloud
BigQuery
Pub/Sub Storage Bigtable Datastore

Cloud Vision Cloud Speech Cloud


Cloud Machine
Applications Learning
API API Spanner

Cloud Stackdriver Firebase Assistant


Cloud Natural
Translation API
APIs Language API

GCP Solutions for DevOps Engineers @martonkodok


Cloud Functions Trigger

Cloud Storage Compute Engine EAP Cloud Pub/Sub

Finalize/Create Instance Topic

Delete Instance Group

Archive Autoscaler

Metadata Update Firewall

Set Labels

GCP Solutions for DevOps Engineers @martonkodok


Cloud Functions Trigger

Firebase BigQuery Cloud Firestore

Realtime DB change Job create Create

Authentication Job complete Update

Remote config Write

Google Analytics log Delete

GCP Solutions for DevOps Engineers @martonkodok


Summary: When to use what

Cloud Functions App Engine Serverless add-on

Smallest unit of Unit of computing Run functions, apps


computing is apps & containers on
GKE
Event driven HTTP
architecture request/response Full portability of
your artifacts
Connect & extend Large scalable
services backends Run on your own
cluster

GCP Solutions for DevOps Engineers @martonkodok


The unit of computing is yours to chose!

Slice and dice your application any way you


think it makes sense to be more agile, to build
better apps that deliver value.

GCP Solutions for DevOps Engineers @martonkodok


How I Learned How to Stop Worrying
and Dig Hosted Monitoring

GCP Solutions for DevOps Engineers @martonkodok


What to do for monitoring?
● In-house or hosted?
● Modern vs proven?
● Specialized or general?
● Paid vs free?

Let’s be honest:
● Not enough time
● Small environment
● More important work to do
● Everyone else is doing it

GCP Solutions for DevOps Engineers @martonkodok


Google Stackdriver
Intelligent monitoring and management
for services, containers, applications, and
infrastructure.

● Works with GCP, AWS, on prem


● Logging, tracing, alerts
● Collectd agent
● Cost per resource
● Easy point and click alerting policy
● Debugger, Error reporting, profiler *free
● Uptime checks *free

GCP Solutions for DevOps Engineers @martonkodok


Google Stackdriver: Uptime check (offered free)
● Check Type: HTTP, TCP
● Resource Type: URL, Instance, App Engine, Load Balancer
● Global Locations
● Custom Headers (encrypted)
● Authentication
● Whitelisted source IPs
● Alerting policy: Email, SMS, Slack, PagerDuty, Hipchat, Campfire, Webhooks

GCP Solutions for DevOps Engineers @martonkodok


Google Stackdriver: Uptime check

GCP Solutions for DevOps Engineers @martonkodok


Life of a log

GCP Solutions for DevOps Engineers @martonkodok


Google Stackdriver

Metrics, logging, alerting are a universal right!

GCP Solutions for DevOps Engineers @martonkodok


GCP Solutions for DevOps Engineers @martonkodok
What is BigQuery?

Analytics-as-a-Service - Data Warehouse in the Cloud


Scales into Petabytes on Managed Infrastructure - load up to 5TB large files
SQL 2011 + Javascript UDF (User Defined Functions)
Familiar DB Structure (table, columns, views, struct, nested, JSON)
Integrates with Google Sheets + Cloud Storage + Pub/Sub connectors
Decent pricing (storage: $20/TB cold: $10/TB,queries $5/TB) *March 2019

GCP Solutions for DevOps Engineers @martonkodok


Architecting for The Cloud
On-Premises Servers

Frontend
Platform Services

Pipelines

Event Sourcing ETL


Engine

BigQuery
Metrics / Logs/
Streaming

GCP Solutions for DevOps Engineers @martonkodok


BigQuery: federated data access warehouse
Application & Presentation
Audit logs
Billing entries

Analysis

Stackdriver

Processing
Firebase

Cloud
Dataflow ML

Cloud
Storage
BI Interface
Database Data Studio 360
SQL
Frontend
Platform Services Report & Share
Business Analysis

Real-Time Events
Multiple Platforms
Google
Marketing
Platform

GCP Solutions for DevOps Engineers @martonkodok


“ Data needs to be processed in
multiple services.
How can we pipe to multiple places?

GCP Solutions for DevOps Engineers @martonkodok


Architecting for The Cloud
On-Premises Servers Process Analyze
Data Third-Party
Studio Tools

Frontend BigQuery
Platform Services

Stream

Event Sourcing Cloud


Cloud SQL
Dataflow

Batch
Metrics / Logs/
Streaming
Cloud Storage

GCP Solutions for DevOps Engineers @martonkodok


“ We have our app outside of GCP.
How can we use the benefits of BigQuery?

GCP Solutions for DevOps Engineers @martonkodok


Data Pipeline Integration at REEA.net
Development On-Premises Servers
Team
Frontend
Platform Services
Load / Export
Replay Report & Share
archive
Business Analysis
Event Sourcing

Standard Cloud Storage


Devices Metrics / Logs/
HTTPS Streaming

Cloud
Pipelines Functions Tools

Tableau
FluentD

QlikView

Analytics Backend
Application Database BigQuery Data Studio

Servers
Servers SQL
Internal
Dashboard

GCP Solutions for DevOps Engineers @martonkodok


The following slides will present a sample Fluentd configuration to:

1. Transform a record
2. Copy event to multiple outputs
3. Store event data in File (for backup/log purposes)
4. Stream to BigQuery (for immediate analyses)

GCP Solutions for DevOps Engineers @martonkodok


<filter frontend.user.*> Filter plugin mutates incoming data. Add/modify/delete
@type record_transformer 1 event data transform attributes without a code deploy.
</filter>

<match frontend.user.*> The copy output plugin copies events to multiple outputs.
@type copy 2 File(s), multiple databases, DB engines.
<store> Great to ship same event to multiple subsystems.
@type forest
subtype file 3
</store>
<store> The Bigquery output plugin on the fly streams the event to
@type bigquery 4 the BigQuery warehouse. No need to write integration.
</store> Data is available immediately for querying.


Whenever needed other output plugins can be wired in:
</match> Kafka, Google Cloud Storage output plugin.

GCP Solutions for DevOps Engineers @martonkodok


1 record_transformer 2 copy 3 file 4 BigQuery

<filter frontend.user.*> syntax: Ruby, easy to use.


@type record_transformer
enable_ruby Great for:
remove_keys host - date transformation,
<record> - quick normalizations,
bq {"insert_id":"${uid}","host":"${host}", - calculating something on the fly,
"created":"${time.to_i}"} and store in clear log/analytics db
avg ${record["total"] / record["count"]} - renaming without code deploy.
</record>
</filter>

GCP Solutions for DevOps Engineers @martonkodok


1 record_transformer 2 copy 3 file 4 BigQuery

<match frontend.user.*>
@type copy
<store>
@type forest
subtype file
<template>
path /tank/storage/${tag}.*.log
time_slice_format %Y%m%d
</template>
</store>
</match>

GCP Solutions for DevOps Engineers @martonkodok


1 record_transformer 2 copy 3 file 4 BigQuery
<match frontend.user.*>
@type bigquery
method insert Connector uses:
auth_method json_key - JSON key auth file
json_key /etc/td-agent/keys/key-31da042be48c.json - JSON table schema
time_field timestamp
time_slice_format %Y%m%d Pro features:
table user$%{time_slice} - streaming to Partitioned tables
ignore_unknown_values - ignore unknown values
schema_path /etc/td-agent/schema/user_login.json (not reflected in schema)
</match>

GCP Solutions for DevOps Engineers @martonkodok


Our benefits using BigQuery
● SQL+JSON (big costs saving with partitioning/clustering)
● run raw ad-hoc queries (either by analysts/sales or Devs)
● ability to throw in / join all kind of data
● pricing model 1TB free every month
● no more throwing away-, expiring-, aggregating old data
● no provisioning/deploy
● no running out of resources
● no more focus on large scale execution plan

GCP Solutions for DevOps Engineers @martonkodok


Qwiklabs - Find Your Topic and Skill Level
Kubernetes Machine Learning Certification

Introductory Enroll in the Baseline: Infrastructure Enroll in the Baseline: Data, ML, AI Quest. Enroll in the Cloud Architecture Quest.
Quest. 1. Cloud ML Engine: Qwik Start (lab) 1. Stackdriver Qwik Start: Web UI (lab)
For GCP
1. Kubernetes Engine: Qwik Start (lab) (video) - Train and deploy a TensorFlow What’s up with your VM? Learn to install
newcomers (video) - Deploy a containerized model to Cloud ML Engine. monitoring and logging agents to collect
1 hour duration, application with Kubernetes Engine. 2. Cloud Natural Language API: Qwik info about your GCP resources.
2 labs 2. IoT: Qwik Start (lab) - Learn about Start (lab) - Perform sentiment analysis on 2. Getting Started with Cloud KMS (lab) -
GCP’s Cloud IoT Core service, where a block of text. For fun, paste in the last Create your first KeyRing and CryptoKey
almost any IoThing is possible! email you sent! with GCP.

Experienced Enroll in the Kubernetes Quest. Enroll in the Machine Learning APIs Quest. Enroll in the Cloud Architecture Quest.
1. Kubernetes Engine: Qwik Start (lab) 1. Cloud ML Engine: Qwik Start (lab) 1. Stackdriver Qwik Start: Web UI (lab) -
Qwiklabs
(video) - Deploy a containerized (video) - Train and deploy a TensorFlow What’s up with your VM? Learn to install
alumni application with Kubernetes Engine. model to Cloud ML Engine. monitoring and logging agents to collect
1 hour, 2 labs 2. Intro to Docker (lab) 2. Detect Labels, Faces, and Landmarks info about your GCP resources.
Are your containers running? Create, in Images with the Cloud Vision API (lab) 2. Application Performance Management
run, and debug containers, then pull and - How do you feel about self-driving cars? (APM) with Stackdriver (lab) - Dig deeper
push images to and from Google Learn what’s behind the AI making the into Stackdriver with a problematic
Container Registry. future possible. environment - can you identify the issues?

GCP Solutions for DevOps Engineers @martonkodok


Thank you.

Slides available on: slideshare.net/martonkodok

Reea.net - Integrated web solutions driven by creativity to deliver


projects.

You might also like