3. WHAT ABOUT US?
• Boutique software development company
• Domains: News Publishing & Sport Industries
• Cutting Edge Technologies
Mobile & Web
Apps
Complete Software
Solutions
The A-Team
Developers
5. Principles of IaC
EASILY REPRODUCED SYSTEMS
DISPOSABLE
CONSISTENT
REPEATABLE PROCESSES
DESIGN IS ALWAYS CHANGING
6. Best Practices
Use definition files
Continuously test
Version everything
Small changes rather than batches
Keep services available continuously
Self-Document
9. Load Balancer
MONGO
DEPLOYMENT
API Service
API POD
API POD
API POD
Nginx
Service
Nginx
POD
Nginx
POD
Dashboard
Service
Dashboard
POD
Scheduler
Mongo Daily
Stats Job
BigQuery
Backup Job
Kubernetes Cluster
10. How We Did It
Environment & Deployment Easy Wins
11. • Snowflake: Servers → Environment
• Configuration Hell
• Config Deployment Procedures
• Cumbersome deployments
• Production/Test deployments → one team member
• Inconsistent resource naming
• Confusing documentation
Don`t Go There
12. • Fully Automate Environment Creation
• GKE cluster configs at one repo
• Optimise Prod/Test Deployments/Rollbacks
• Establish components` naming conventions
• Two Github repos:
• Infrastructure creation - Ansible playbooks defining it
• K8s cluster repo - Cluster components definitions
What did we do?
14. Docker Images
• Min. Config → Just do IT
• Single Playbook - Ansible docker_images module
• Automatic Images Upload to GKE Registry
Step 1
15. Docker Images
• Automated initial images building
→faster set up, less error prone
• Naming Convention is applied
• Images go to the proper registry when ready
Step 1
WINS
23. GKE
Registry
Images:
Nginx, API,
DataFlow,
Parse Dashb.
Scheduler:
Mongo Stats,
BigQuery
Backup
Environment Creation Cluster Configuration
Ansible Playbooks
Google
Resources
• GS Buckets
• Service Acc.
• PubSub
Components
• BigQuery
DataSets
Table
Schemas
Cluster,
Component
s
& Services
Cluster is
created first
followed by
components:
Tests
• General
availability
of apps &
Components
• App
integration
tests
Git Commit
Circle CI
Handles the deployment.
Images are already build at an earlier stage
K8s
Components Build
Namespaces,
Services, Secrets,
Deployments,
Jobs, Ingress,
Autoscaler
Services
Deployment
API, Nginx, Scheduler,
Parse Dashboard,
DtaFlow
24. Testing:
• Infrastructure components validation
→ playbooks are imperative(Ansible limitations)
• User permissions
• Services basic health check
• Integration testing - based on the environment
Step 3
25. Testing:
• Validate the Env is in desired state after spin up
• Product is verified to operate properly
Step 3
WINS
27. - name: Fail if system status is not in the page content
fail:
when:
'"{"apiApp":true,"parseServer":true,"cloudCode":true,"mongo
":true}" not in webpage.content'
Step 3
29. • Separate repo holds the cluster configs
• Configuration files are environment agnostic
- `kubectl create -f [conf].yml --namespace [env]`
• Idempotent deployments with ‘kubectl’
• Used for deployments to Prod/Staging
• Tests after every push
Deployment
30. • Centralized config management
• Updates are easily traceable
• Fast rollbacks/deployments to any env
Deployment
WINS
31. Preparation Stage
Circle CI
Git Commit
Dependencies
NPM install,
configure build
cache
Unit Testing
NPM
run tests
Build
Docker build and
tag image
Build Environment
is configured –
node / python /docker
prepared
Tools are installed:
gcloud tools,
kubectl
Configure gcloud and
kubectl to connect to
proper env, based on the
branch
Kubectl uploads the
image to GKE Registry
Image is deployed on the
cluster
Integration tests
Deployment Stage
32. • Infrastructure
- Automated resource provisioning, definitions in VCS
• Applications
- No specialized nodes
- Configs are in VCS
- Improved deployment
• Code
- no special attitude for deploying to any ENV
• Testing
- after each interaction
Conclusion