DevOps Classroom notes 26/Jan/2024

Running pods in kubernetes

Trail 1

  • Run an alpine container in a pod which goes into exited state immedietly Refer Here for the changes
  • Now lets apply the manifest
  • as we know the container will endup in exited state. k8s is trying to restart the container to maintained the desired state. It keeps restarting and if the container doesnot start, it sets the state to CrashloopBackoff and keeps restarting
    Preview

Trail 2

  • Run an alpine contianer with sleep 1d as CMD. Refer Here for the changes
  • Lets apply the manifest
    Preview
  • If we want execute any command in the container
    • Docker docker container exec
    • k8s kubectl exec <pod> -- <cmd>
      Preview
  • Exercise: findout a way to login into specific contianer in a pod used when you multi contianer pods

Trail 3

  • Run an mysql contianer and pass environmental variables to set username, root password, password, database
  • docker command
docker container run -d --name trail3 -e MYSQL_ROOT_PASSWORD=admin123 -e MYSQL_DATABASE=emp -e MYSQL_USER=nop -e MYSQL_PASSWORD=admin123 mysql:8.0-debian
  • Refer Here for the k8s manifest
    Preview
    Preview
  • Exercise: try creating any other database pod (postgres, sqlserver on linux, oracle)

Trail 4

  • Figure out a docker command to create jenkins container with
    • 1 vcpu
    • 512 mb of RAM
  • Also using docker stats view what has been attached to container
  • Google: soft limit hard limit
  • Concepts: Resource Management Refer Here
    • Requests
    • Limits
  • Lets write the kuberentes manifest to create a jenkins container in it with
    • request: 0.5 cpu , 256 Mi
    • limit: 1 cpu, 1 GB
  • Refer Here for the manifest
    Preview
    Preview

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube