4. Kubernetes basics of manifest file

All is explained in detail here. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#api-overview

This post is just a summary for beginners to work with my tutorials.

Workloads

https://kubernetes.io/docs/concepts/workloads/

A workload is an application running on Kubernetes. Whether your workload is a single component or several that work together, on Kubernetes you run it inside a set of pods. In Kubernetes, a Pod represents a set of running containers on your cluster.

WorkloadsDefinition
PodPods are the smallest deployable units of computing that you can create and manage in Kubernetes. https://kubernetes.io/docs/concepts/workloads/pods/
ReplicaSetA ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods. https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
DeploymentDeployment is a good fit for managing a stateless application workload on your cluster, where any Pod in the Deployment is interchangeable and can be replaced if needed. https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
DemonSetDaemonSet defines Pods that provide facilities that are local to nodes. Every time you add a node to your cluster that matches the specification in a DaemonSet, the control plane schedules a Pod for that DaemonSet onto the new node. Each pod in a DaemonSet performs a job similar to a system daemon on a classic Unix / POSIX server. A DaemonSet might be fundamental to the operation of your cluster, such as a plugin to run cluster networking, it might help you to manage the node, or it could provide optional behavior that enhances the container platform you are running. https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
StatefulSetStatefulSet lets you run one or more related Pods that do track state somehow. For example, if your workload records data persistently, you can run a StatefulSet that matches each Pod with a PersistentVolume. Your code, running in the Pods for that StatefulSet, can replicate data to other Pods in the same StatefulSet to improve overall resilience. https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
JobJob and CronJob provide different ways to define tasks that run to completion and then stop. You can use a Job to define a task that runs to completion, just once. You can use a CronJob to run the same Job multiple times according a schedule. https://kubernetes.io/docs/concepts/workloads/controllers/job/
CronJobexplained above https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/

Directives in Yaml

An example of a Yaml file.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

https://kubernetes.io/docs/concepts/overview/working-with-objects/#required-fields

DirectivesDefinition
apiVersionWhich version of the Kubernetes API you're using to create this object.
kindkind represents the type of Kubernetes objects to be created while using the yaml file. There are two types of objects. 1. Objects represent a persistent entity in the system. Examples: Pod, ReplicationController, Service, Namespace, Node. 2. Lists are collections of resources of one (usually) or more (occasionally) kinds. Examples: PodList, ServiceList, NodeList.
metadataData that helps uniquely identify the object, including a name string, UID, and optional namespace. namespace: a namespace is a DNS compatible label that objects are subdivided into. The default namespace is 'default'. See the namespace docs for more. name: a string that uniquely identifies this object within the current namespace (see the identifiers docs). This value is used in the path when retrieving an individual object. uid: a unique in time and space value (typically an RFC 4122 generated identifier, see the identifiers docs) used to distinguish between objects with the same name that have been deleted and recreated
specWhat state you desire for the object. The precise format of the object spec is different for every Kubernetes object, and contains nested fields specific to that object. The Kubernetes API Reference can help you find the spec format for all of the objects you can create using Kubernetes

Additional Notes

Configuration Best Practices

https://kubernetes.io/docs/concepts/configuration/overview/