DevOps Classroomnotes 20/Feb/2022

Config Maps

  • ConfigMaps are used to provide configuration information for Workloads.
  • This can either be fine-grained information or a composite value in the form of file.
  • ConfigMap is a k8s object that defines a small file system.
  • Another way is a set of variables that can be used when defining the environment or command line for your containers
  • Lets create a sample configuration
    Preview
  • Using a ConfigMap: There are three main ways to use a ConfigMap
    • FileSystem: you can mount a ConfigMap into a Pod. A file is create for each entry based of key name and the contents of the file are set to the value
    • Environment variable:
    • A ConfigMap can be used to dynamically set the value of an environmental variable
    • Command-line argument:
    • K8s supports dynamically creating commnad line for a container using ConfigMap Values
  • Refer Here for the changes
    Preview
    Preview
    Preview

Secrets

  • If you have a configuration value with sensitive information, we use secrets in k8s
  • Secrets can be mounted exactly similar to config maps
    Preview
    Preview
    Preview
  • Refer Here

Init Containers in Pod

  • In Pod we have two types of containers
  • init container:
    • Init container always runs to completion
    • Each init container must complete successfully before the next one starts
    • If Pod’s init container fails, kubelet will restart repeately
    • If init container fails k8s treats the overall Pod as failed
  • regular containers:
    • run our application
  • Refer Here for the changes done
    Preview

Health Checks

  • K8s introduced health checks for application liveness.
  • Liveness health checks run application-specific log to verify that the application is not just still running , but functioning properly
  • Liveness Probe:
  • We need a way to confirm that our application is actually healty & shouldn’t be restarted.
  • Liveness probes are defined per container which means each container inside a Pod is health-checked seperated
  • Refer Here
  • Refer Here for the changes done
  • Readiness Probe:
  • This probe determinse whether the container is ready to serve the user requests
  • container that fail readiness checks are removed from service load balancers
  • Refer Here for the changes done

Resoruce Constraints

Waiting for 10 mins for you do create a docker container with cpu and memory restrictions.

  • Resource Management in k8s is dealt with two major aspects
  • Resource Requests => Minimum Required Resources
  • Resource Limits => Maximum Required Resources
  • Lets create a Pod with limits and request. Refer Here for the official docs
  • Refer Here
    Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner