Skip to Content
This project is a work in progress. If you have any questions or suggestions, feel free to contact me.
KubernetesTools & CommandsManifest Cheatsheet

Manifest cheatsheet

Find the basic manifest file for each object (what I have learned so far) in kubernetes.

Pod Manifest

pod.yml
kind: Pod apiVersion: v1 metadata: name: my-pod spec: containers: - name: c00 image: httpd ports: - containerPort: 80

ReplicaController

replicacontroller.yml
apiVersion: v1 kind: ReplicationController metadata: name: my-replicaController spec: replicas: 5 selector: myname: xander template: metadata: name: rc-pod labels: myname: xander spec: containers: - name: c00 image: httpd ports: - containerPort: 80

ReplicaSet

replicaset.yml
kind: ReplicaSet apiVersion: apps/v1 metadata: name: replicaSet spec: replicas: 2 selector: matchExpressions: - key: myname operator: In values: [xander, billa, kubernetes] - key: env operator: NotIn values: [prod, dev] template: metadata: name: container0 labels: myname: xander spec: containers: - name: c00 image: httpd ports: containerPort: 80

Deployment

deployment.yml
kind: Deployment apiVersion: apps/v1 metadata: name: my-deployment spec: replicas: 2 selector: matchLabels: name: xander template: metadata: name: container0 labels: name: xander spec: containers: - name: c00 image: ubuntu command: [ # Use a list for the command "/bin/bash", "-c", "while true; do echo Hello-from-ubuntu; sleep 5 ; done", ]

Service

service.yml
kind: Service apiVersion: v1 metadata: name: my-service spec: ports: - port: 80 targetPort: 80 selector: name: xander type: NodePort

Volume

volume.yml
kind: Pod apiVersion: v1 metadata: name: my-volume spec: containers: - name: c2 image: centos command: ["/bin/bash", "-c", "sleep 10000"] volumeMounts: - name: xchange mountPath: "/tmp/data" volumes: - name: xchange emptyDir: {}

Persistent Volume

pv.yml
apiVersion: v1 kind: PersistentVolume metadata: name: myebsvol spec: capacity: storage: 1Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Delete awsElasticBlockStore: volumeID: <YOUR_EBS_VOLUME_ID> #vol-094d8143b2ad46204 fsType: ext4

Persistent Volume Claim

pvc.yml
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: myebsvolclaim spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi
Last updated on