Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Kubernetes Containers in DevOps

Containers
  • Images
  • Container Environment Variables
  • Runtime Class
  • Container LifeCycle Hooks

 Runtime Class :

RuntimeClass is an alpha feature for selecting the container runtime configuration to use to run a pod's containers.
Set Up

As an early alpha feature, there are some additional setup steps that must be taken in order to use the RuntimeClass feature:

Enable the RuntimeClass feature gate (on apiservers & kubelets, requires version 1.12+)


Install thge RuntimeClass CRD

Configure the CRI implementation on nodes (runtime depedent)
Create the corresponding RuntimeClass resource 

Once RuntimeClasses are configured for the cluster, using them is very simple.

Specify a runtimeClassName in the Pod spec.

For example:
      apiVersion: v1 kind: Pod metadata: name: mypod spec: runtimeClassName: myclass

Container Lifecycle Hooks

The hooks enable Containers to be aware of events in their management lifecycle and run code implemented in a handler when the corresponding lifecycle hook is executed.

There are two hooks that are exposed to Containers:
  • PostStart
  • PreStop


Hook handler implementations:
  • Contaoners can access a hook by implementing and registering a handler for that hook.
  • There are two types of hook handlers that can be implemented for Containers:
  • Exec
  • HTTP
Hook handler execution:
  • When a Container lifecycle management hook is called, the Kubernetes management system executes the handler in the Container registered for that hook.
Hook delivery guarantees:
  • Hook delivery is inteded to be at least once, which means that a hook may be called multiple times for any given, such as for PostStart of PreStop. It is up to the hook implementation to handle this correctly.

No comments:

Post a Comment

Popular Articles