Effectiveness tips from K8S
trenches by Captain Obvious
Mikalai Alimenkou
@xpinjection
https://t.me/xpinjection_channel
https://xpinjection.com
Telegram channel
https://t.me/xpinjection_channel
Disclaimer
This talk is based on
personal experience
K8S is an orchestration flagman
Everything is so simple…
But reality is not always the same
Feel the difference
Deploy single
microservice to
Kubernetes
Deploy and maintain
production workload
to Kubernetes
All tips are really obvious
#1. Don’t start with K8S ;)
Focus on business first
Don’t invest into complex infrastructure from start
Use PaaS cloud solutions if possible
“Buy” more time for business focus
Containerize your services for flexibility
Experiment with K8S on local dev environments
#2. Develop Cloud Native services
Use best practices and enablers
Choose Cloud Native platform if possible
Follow best practices for 12+ factor applications
Use available enablers and libraries
Focus on the most important aspects:
- flexible configuration;
- full observability;
- stateless.
You could migrate anywhere later
#3. Avoid K8S maintenance
Delegate complexity
Build on managed K8S where possible
Try K8S wrappers instead of vanilla K8S
Use public Helm charts for dependencies
Try public K8S operators to delegate maintenance for
dependencies as well
Use service mesh if don’t want to rely on developers
level and use cross-language microservices
#4. Switch to declarative mindset
Forget imperative habits from the past
All K8S resources are just declarations
OK response on API call means resource is accepted
Avoid imperative commands for all types of action
Deployment may fail even at container level
Use extended monitoring to control actual state of the
cluster
Log kubernetes.io/change-cause for deployment
traceability
#5. Don’t be hype-driven maniacs
NO ROOM
FOR LEGACY!
Keep you platform as simple as possible
Service mesh is great but not for everybody
Every new component increases maintenance cost
Start with plain K8S manifests
Use templating and customization if more flexibility is
required
Switch to Helm only in complex cases
#6. Define clear roles/responsibilities
Establish clear DevOps boundaries
Infrastructure engineers responsible for low level
infrastructure (cloud, bare metal, mixed)
Dedicated K8S engineers responsible for K8S platform
Developers responsible for their services deployment,
configuration and support
SRE engineers responsible for SRE practices and toolset
establishment
More balanced development
#7. Implement business health checks
Don’t be lazy developer
Don’t rely on simple HTTP ping
Distinguish liveness and readiness probes
Be careful with returned HTTP status
Add business context to liveness and readiness probes
Implement and configure graceful shutdown where
possible
#8. Simplify dev environments
Provide environments for all needs
Share data storages between environments if possible
Make environment lightweight to use everywhere
(feature branches, pull requests, CI builds,
dev/qa/demo)
Share the same K8S cluster with isolated namespaces
Use node level cache for quick start
Automate environment setup for developers
Use CD tools like scaffold for development speed
#9. Don’t forget about limits
Defaults bring hidden issues
Define RAM/CPU requirements for all services
Limit resources usage per namespace
Be careful with default network policy
Complex network setup requires special skills
Pay attention to security guidelines
Apply strict access policies
Use dedicated clusters for isolated environments
#10. Not all nodes are equal
K8S is not about “commodity hardware”
Use labels for nodes to control deployment specifics
(storage type, node size, CPU capacity, etc.)
Carefully choose node size, taking into account all
sidecar containers and daemon sets
Save money on spot instances for dev environments
Don’t forget about latency and volume speed for data
storages
Use node level caches to speed up deployments
Summary and take aways
K8S is great orchestration tool, but not given for free
Containerized Cloud Native services run everywhere
New roles needed to set proper DevOps boundaries
K8S ecosystem is hype-driven and growing very quickly
Environment should be really easy to start
Everything is still working on hardware
Pay special attention to security and network
@xpinjection
https://xpinjection.com
https://t.me/xpinjection_channel

Effectiveness tips from Kubernetes trenches by Captain Obvious

  • 1.
    Effectiveness tips fromK8S trenches by Captain Obvious Mikalai Alimenkou @xpinjection https://t.me/xpinjection_channel https://xpinjection.com
  • 3.
  • 4.
    Disclaimer This talk isbased on personal experience
  • 5.
    K8S is anorchestration flagman
  • 6.
  • 7.
    But reality isnot always the same
  • 8.
    Feel the difference Deploysingle microservice to Kubernetes Deploy and maintain production workload to Kubernetes
  • 9.
    All tips arereally obvious
  • 10.
    #1. Don’t startwith K8S ;)
  • 11.
    Focus on businessfirst Don’t invest into complex infrastructure from start Use PaaS cloud solutions if possible “Buy” more time for business focus Containerize your services for flexibility Experiment with K8S on local dev environments
  • 12.
    #2. Develop CloudNative services
  • 13.
    Use best practicesand enablers Choose Cloud Native platform if possible Follow best practices for 12+ factor applications Use available enablers and libraries Focus on the most important aspects: - flexible configuration; - full observability; - stateless. You could migrate anywhere later
  • 14.
    #3. Avoid K8Smaintenance
  • 15.
    Delegate complexity Build onmanaged K8S where possible Try K8S wrappers instead of vanilla K8S Use public Helm charts for dependencies Try public K8S operators to delegate maintenance for dependencies as well Use service mesh if don’t want to rely on developers level and use cross-language microservices
  • 16.
    #4. Switch todeclarative mindset
  • 17.
    Forget imperative habitsfrom the past All K8S resources are just declarations OK response on API call means resource is accepted Avoid imperative commands for all types of action Deployment may fail even at container level Use extended monitoring to control actual state of the cluster Log kubernetes.io/change-cause for deployment traceability
  • 18.
    #5. Don’t behype-driven maniacs NO ROOM FOR LEGACY!
  • 19.
    Keep you platformas simple as possible Service mesh is great but not for everybody Every new component increases maintenance cost Start with plain K8S manifests Use templating and customization if more flexibility is required Switch to Helm only in complex cases
  • 20.
    #6. Define clearroles/responsibilities
  • 21.
    Establish clear DevOpsboundaries Infrastructure engineers responsible for low level infrastructure (cloud, bare metal, mixed) Dedicated K8S engineers responsible for K8S platform Developers responsible for their services deployment, configuration and support SRE engineers responsible for SRE practices and toolset establishment
  • 22.
  • 24.
  • 25.
    Don’t be lazydeveloper Don’t rely on simple HTTP ping Distinguish liveness and readiness probes Be careful with returned HTTP status Add business context to liveness and readiness probes Implement and configure graceful shutdown where possible
  • 26.
    #8. Simplify devenvironments
  • 27.
    Provide environments forall needs Share data storages between environments if possible Make environment lightweight to use everywhere (feature branches, pull requests, CI builds, dev/qa/demo) Share the same K8S cluster with isolated namespaces Use node level cache for quick start Automate environment setup for developers Use CD tools like scaffold for development speed
  • 28.
    #9. Don’t forgetabout limits
  • 29.
    Defaults bring hiddenissues Define RAM/CPU requirements for all services Limit resources usage per namespace Be careful with default network policy Complex network setup requires special skills Pay attention to security guidelines Apply strict access policies Use dedicated clusters for isolated environments
  • 30.
    #10. Not allnodes are equal
  • 31.
    K8S is notabout “commodity hardware” Use labels for nodes to control deployment specifics (storage type, node size, CPU capacity, etc.) Carefully choose node size, taking into account all sidecar containers and daemon sets Save money on spot instances for dev environments Don’t forget about latency and volume speed for data storages Use node level caches to speed up deployments
  • 33.
    Summary and takeaways K8S is great orchestration tool, but not given for free Containerized Cloud Native services run everywhere New roles needed to set proper DevOps boundaries K8S ecosystem is hype-driven and growing very quickly Environment should be really easy to start Everything is still working on hardware Pay special attention to security and network
  • 34.

Editor's Notes

  • #24 Не может быть волшебных практик как Continuous Delivery. Вжух и уже есть CD! Это требует изменений на культурном уровне. Поэтому переименование ролей никак не помогает что-то улучшать.