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

K8s Workloads

  • Refer Here for the official docs
  • 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)
  • Each Pod gets a unique ip address
  • Pod can have multiple containers
  • Scaling in k8s is increasing number of pods not containers
  • Pod gets assigned to node
  • Refer Here for official docs
  • Refer Here for podspecs
  • kubectl cheatsheet Refer Here
  • using kubectl to create pods
  • commands
kubectl apply -f
kubectl get <api-resource>
kubectl describe <kind> <name>



* To view the complete manifest created by k8s

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

Exercises

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

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%