DevOps Classroomnotes 23/Apr/2023

Kubernetes Objects

  • Every thing in k8s is an object.
  • Every object has a spec and status
  • spec: specification (what we have asked)
  • status: (what was created)

Kuberenetes API-Resources

  • The resources exposed by api-server
    Preview

K8s Workloads

  • Refer Here for the official docs
    Preview
  • Pods:
  • Primitive of k8s.
  • The smallest unit of creation is Pod.
  • Pod has container(s)
  • Every Pod gets an IP address

How to Create Resources in K8s

  • We would be creating k8s manifests i.e yaml files
  • For this we need to understand
    • yaml
    • api versioning
    • Spec and Status

API Versioning

  • Refer Here for docs
  • APIs are grouped as apigroups:

    • core
    • batch
    • networking.k8s.io
  • Api version: This is written as <groupname>/<Version>, if the group name is core <version>
  • In this groups we have kind of api-resources

Defining Resources in a manifest file

  • To define a resource in a manifest file we create a yaml file with following structure
apiVersion: 
kind:
metadata:
spec:

Pods

  • Pod is atomic unit of creation in k8s cluster
  • Pod contains container(s)
    Preview
  • Each Pod gets a unique ip address
  • Pod can have multiple containers
  • Scaling in k8s is increasing number of pods not containers
    Preview
  • Pod gets assigned to node
  • Refer Here for official docs
  • Refer Here for podspecs
  • kubectl cheatsheet Refer Here
  • using kubectl to create pods
    Preview
  • commands
kubectl apply -f
kubectl get <api-resource>
kubectl describe <kind> <name>

Preview
Preview
* To view the complete manifest created by k8s

kubectl get <kind> <name> -o yaml
  • delete pods
    Preview

Preview

Exercises

  • Write a manifest file to create
    • nginx
      Preview
    • nginx and alpine with sleep 1d
      Preview
    • nginx ,alpine with sleep 1d and alpine with 10s
      Preview
    • nginx and httpd with 80 port exposed
      Preview
  • Refer Here for the changeset with 4 yamls

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
Social Media Icons Powered by Acurax Web Design 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