DevOps Classroom notes 25/Jan/2024

YAML

Writing k8s manifests

  • When we write manifest we interact with api server using kubectl
  • kube API Server exposes k8s resources as REST API’s
  • kuberentes api versioning: Refer Here
    • apigroup: this is grouping by k8s for versioning
    • version:
  • every k8s resource which we create we need to write apiVersion
# rule
apiVersion: <group>/<version>

# if the group is core
apiVersion: <version>

Activity 1: lets create an httpd pod manifest

  • Docker image information
    • image: httpd:2.4
    • port: 80
  • Lets write manifest:
---
apiVersion: v1
kind: Pod
metadata:
  name: httpd-pod
spec:
  containers:
    - name: httpd
      image: httpd:2.4
      ports:
        - containerPort: 80
          protocol: "TCP"

Activity 2: Create a Pod with two containers

  • Create a pod with two httpd containers
---
apiVersion: v1
kind: Pod
metadata:
  name: httpd-twice
spec:
  containers:
    - name: httpd1
      image: httpd:2.4
      ports:
        - containerPort: 80
    - name: httpd2
      image: httpd:2.4
      ports:
        - containerPort: 80
  • Two contianer in the Pod should not be using the same port
    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