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

Like this:
Like Loading...