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
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

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
Exit mobile version
%%footer%%