DevOps Classroom Series – 22/Nov/2020

K8s Jobs and CronJobs

  • Lets assume you want to run a Pod which runs a task and then terminates gracefully, To solve these kind of Problems k8s has Jobs & CronJobs
  • The difference b/w k8s job & CronJob is CronJobs can be scheduled to run on a particular time frame
  • Run the job as mentioned in the changeset Refer Here Preview

K8s Ingress

  • Ingress is an object in k8s that is used manage external access to services in the k8s cluster. Ingress provides layer 7 load balancing, so it will be aware of url’s
  • Refer Here Preview

Scenario:

  • I have a application component which is running in a pod
  • I have a database pod
  • Application Pod is configured to scale automatically Preview
  • Now application pod needs to access db
  • Approach 1:
    • Create a service for db Preview
    • Whenever you add a service an environmental variables will be added in all pods containing svc ip and port Preview
  • Approach 2:
    • Use a Config Map. Config Map is a k8s object allows us to defined the application-related data.
    • Config maps are key value pairs
    • You can create config maps from
      • literal value
      • file
      • directory
    • Lets create a sample config map
    kubectl create configmap demovalue-map --from-literal=db-ip=10.0.83.222 
    
    Preview Preview
  • In K8s we also have secret which are much like config maps but they can store secret of size 1kb in base 64 encoded form

Package Manager for k8s : Helm

  • Helm is a Package manager for k8s
  • Helm charts represent a k8s package
  • Installing helm Refer Here
  • Lets execute an example using helm in AKS Refer Here
  • In k8s we write yaml manifests, helm simplifies and makes manfiests reusable
  • Refer Here
  • Journey of App from docker to k8s Refer Here

Leave a Reply

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

About learningthoughtsadmin