GithubHelp home page GithubHelp logo

learnk8s / kubernetes-production-best-practices Goto Github PK

View Code? Open in Web Editor NEW
1.0K 46.0 207.0 5.99 MB

A checklist of Kubernetes best practices to help you release to production

Home Page: https://learnk8s.io/production-best-practices

License: MIT License

kubernetes best-practices

kubernetes-production-best-practices's Introduction

kubernetes-production-best-practices's People

Contributors

bparry02 avatar chrisns avatar danielepolencic avatar dantwining avatar ebriand avatar flickerfly avatar salmaniqbal avatar tiggreen avatar tmr08c avatar weibeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubernetes-production-best-practices's Issues

use kube2iam in favor of disabling metadata endpoints

This checklist:

Disable metadata cloud providers metada[sic] API

In AWS, this advice precludes containerized applications from using for example AWS IAM role based authentication, a security best practice: credentials are not hard coded, are automatically rotated, and will likely never leave the cluster itself. For more information on this best practice, read here: https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html#use-roles

As a best practice to use this, I would recommend using kube2iam (https://github.com/jtblin/kube2iam) -- this allows you to control which roles a pod is allowed to assume based on namespace, but also allows the pod to see itself as having the role vs requiring it to assume such a role.

In our setup we use kube2iam and assign nodes their IAM role - this IAM role is allowed to assume other roles. With kube2iam, we assign the role through a pod annotation, so the pod sees itself as having that role. Additionally we use namespace restrictions to control access to which roles a pod is allowed to assume.

which is the repo's license?

thanks for this awesome resource!

the text on learnk8s.io says the repo is open source - could you perhaps add a license?

Checklist v2

Feature ideas for v2 of the checklist

➡️ Contributions are welcome! Just add your ideas to this issue. ⬅️

  1. Uniform structure for all items
    • Proposal: What?, Why?, How?, References
    • Makes it easier to comprehend items (and easier to write them)
  2. Organise items by tags
    • No hardcoded categories. Makes it easier to discover items, but also to add items: no need to decide which category to add an item to, just add the item and assign it a set of relevant tags.
  3. Incremental search
    • Incremental search that displays matching items as the search term is typed.
    • Search based on title, content, and possibly tags (if the tag-based organisation is implemented)
  4. Tag selection
    • Display all available tags and allow to filter out the items matching one or more selected tag (if the tag-based organisation is implemented)
  5. Table of contents
    • If not using a tab-based system, include a table of contents with all items
    • Example: https://webconverger.com/faq/
    • Could also be used with a tag-based system to give a concise overview of the currently selected items

Include and review kube-score

From kube-score readme:

  • Container limits (should be set)
  • Pod is targeted by a NetworkPolicy, both egress and ingress rules are recommended
  • Deployments and StatefulSets should have a PodDisruptionPolicy
  • Deployments and StatefulSets should have host PodAntiAffinity configured
  • Container probes, both readiness and liveness checks should be configured, and should not be identical
  • Container securityContext, run as high number user/group, do not run as root or with privileged root fs
  • Stable APIs, use a stable API if available (supported: Deployments, StatefulSets, DaemonSet)

More: https://github.com/zegl/kube-score/blob/master/README_CHECKS.md

Clarify "Liveness probes values aren't the same as the Readiness"

In Liveness probes values aren't the same as the Readiness:

  • The title suggests "values"
  • The text body speaks about "endpoint":

When Liveness and Readiness probes are pointing to the same endpoint, the effects of the probes are combined.

I think the title is correct, and the task body should be updated to reflect that it's generally fine to have the same endpoint called from liveness and readiness probes, as long as the values are different (and those for liveness are more tolerant than those for readiness).

Referenced article Liveness probes are dangerous:

if you use Liveness Probe, don’t set the same specification for Liveness and Readiness Probe

  • you can use a Liveness Probe with the same health check, but a higher failureThreshold (e.g. mark as not-ready after 3 attempts and fail Liveness Probe after 10 attempts)

Cluster must haves

@ipedrazas has just presented at Cloud Native Wales and he has a "must-have" list which looks quite interesting.

image

image

We might need to borrow a few items.

Slides

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.