- Docker : 1.12.6
- Kubernetes : 1.7.0
- NPM : 3.5.2
- Node Image : Boron
- SCM: Github
- Build: Shell Script and SSH
- REPO Management: Docker Hub
- CI and CD: Jenkins, SSH, and Terraform (K8S cluster creation with Kubernetes Operations via Terraform manifests)
- Testing: Mocha and SonarQube
- Collaboration and Communication: Slack
- Operational Intelligence: Datadog
- Container Security: Anchore Scanner
- Deployment: Kubernetes, Amazon Web Services, and Docker
- Logging: Sematext
- SCM - Github polling included for the all the branches. Jenkins is self-hosted on AWS. Jenkins is deployed with master and slave architecture. Jenkins-MAster and Jenkins-Slave.
- Building the Job: Webhook is added to the GitHub repo and builds job is executed with the shell script.
- Steps followed to build job:
i. Pulling the branch and checkout
ii. SonarQube Analysis of the Code
iii. Shell Script: Creates the test container which will execute the sample tests. If succeed then an image is prepared for production. Docker login with environment variables attached with Jenkins-slave node. Check
hello-world-ci-cd/deploy-docker.sh
. - Anchore scanning of the Images to check container security.
- Deleting test images from local Jenkins-slave through the shell script. Check
hello-world-ci-cd/delete-docker.sh
.
- Shell Script: Logging into the cluster node. Download the manifests from the Github and apply the changes. Rolling update and rollback options are given through environment variable
DEPLOYMENT_TYPE
. Checkhello-world-ci-cd/post-build.sh
. - Setting up the GitHub commit status.
- Slack Notifications of the build actions to notify the status.
Monitoring Tools used: Datadog (internally using cloudwatch and cloud trail), Heapster (Native monitoring for the Kubernetes).
Datadog is used for operational intelligence. Datadog is connected with the slack channel for sending the alert. Kubernetes, Docker and AWS specific metrics are provided with Datadlg with the in-depth level of customization and alerts.Check hello-world-ci-cd/kubernetes/monitor/dd-agent.yml
Define Monitors to trigger the events (Warning, alert, ok ):
Kubernetes native level monitoring with heapster allows horizontally scale the Pods. Here, the pod is deployment unit for kubernetes. In this deployment, one pod only consists one container. With the use of heapster horizontal pod, scaling is added with default minimum 5 to maximum 50 replicas. Check hello-world-ci-cd/kubernetes/autoscaler/pod-autoscaler.yml
Datadog also monitors the Kubernetes Metrics:
The container logs are centralized with sematext. Check hello-world-ci-cd/kubernetes/logging/sematext-agent.yml
.
- Node Zones: us-east-1a,us-east-1b,us-east-1c
- Master Zones: us-east-1a,us-east-1b,us-east-1c
- Number of Master Nodes: 3
- Number of Nodes: 3
- Container Networking: Flannel
- Cluster Environment: Private
- Bastion host: Used
- etc is encrypted for the storage.
App is deployed with Kubernetes deployment and service objects. Check hello-world-ci-cd/kubernetes/app/
.
Horizontal Pod Autoscaler is created for the app pods. Check hello-world-ci-cd/kubernetes/autoscaler/
.
The app is exposed with service object of the Kubernetes through classic load balancer of the AWS.
The final endpoint is http://app.dockerslab.com
.