https://kccna18.sched.com/event/GrUI/custom-deployment-strategies-for-kubernetes-nail-islamov-atlassian
Many tech companies are using continuous deployments (CD) to deliver changes to their users faster and more frequently. One of the challenges with automated deployments is making them safe by detecting and quickly rolling back in the event of a bad release. Standard CD practices include using canary and blue-green deployments; unfortunately, Kubernetes only supports the "rolling update" deployment strategy out of the box, which can only prevent trivial failures. Thanks to extensibility of Kubernetes, it is possible to build custom advanced deployment strategies while reusing Kubernetes core concepts. Nail Islamov will give an overview of how Deployment, ReplicaSet and Pod objects work together along with Service and Ingress, and will provide examples of implementing blue-green and canary deployments reusing these concepts by introducing extra CRD resources.
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Canary Deployments for Kubernetes (KubeCon 2018 North America)
1. NAIL ISLAMOV | SENIOR DEVELOPER | @NILEBOX
Custom Deployment Strategies
for Kubernetes
2. Continuous delivery is an approach where
teams release products frequently and
predictably from source code repository to
production in an automated fashion.
CONTINUOUS DELIVERY
3. CI/CD PIPELINE
Build & Test
Deploy to
Staging
Acceptance
Tests
Deploy to
Production
Monitoring
4. CI/CD PIPELINE
Build & Test
Deploy to
Staging
Acceptance
Tests
Deploy to
Production
Monitoring
6. Recreate
Kill all existing pods before creating new ones.
RollingUpdate
Gradually scale down the old ReplicaSets and
scale up the new one.
Deployment
strategies
7. Recreate
Kill all existing pods before creating new ones.
RollingUpdate
Gradually scale down the old ReplicaSets and
scale up the new one.
Deployment
strategies
21. Canary release is a technique to reduce the
risk of introducing a new software version
in production by slowly rolling out the
change to a small subset of users before
rolling it out to the entire infrastructure and
making it available to everybody.
MARTINFOWLER.COM
31. EXAMPLE
kubectl apply -f deployment-canary.yaml
sleep 5m # wait for rollout to finish
# check if application is healthy
curl http://metrics:9090/my-metric
# proceed or rollback
if ...
kubectl apply -f deployment-stable.yaml
33. How do we automate the
deployment rollout?
Scripts in CI/CD tool.
CRD controller?
34. Self-healing
Reconciliation loop will keep
retrying until reaching the
final state
Benefits of CRDs
Reusable
Building block that can be
used together with other
Kubernetes resources
Declarative
Describes the desired state,
not the steps to reach it
65. Key takeaways for CRDs
Use abstractions
Generic APIs are reusable.
Use the power of open source
Read existing code and share your own code.
Reuse existing resources
No need to reinvent the wheel.
Keep it simple
Solve a minimal subset of a problem at once.