What is a Kubernetes Manifest?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Kubernetes is a powerful platform for automating the deployment, scaling, and operation of application containers. A core component in managing these applications is the Kubernetes Manifest. A Kubernetes Manifest is a YAML or JSON configuration file that describes the desired state and behavior of various components within a Kubernetes cluster, such as Pods, Services, Deployments, and more.
Why Use Manifests?
Manifests play a vital role in establishing a declarative approach to managing applications within Kubernetes. By using Manifests, you can easily define, deploy, and maintain configurations, allowing Kubernetes to continuously monitor and ensure that the actual state mirrors the desired state as specified.
Basic Structure
A Kubernetes Manifest file typically includes these key sections:
- apiVersion: Describes the version of the Kubernetes API you're using.
- kind: Specifies the kind of object you're creating (e.g., Pod, Service, Deployment).
- metadata: Provides metadata about the object, such as name and labels.
- spec: Details the desired behavior and characteristics of the object.
Example Kubernetes Manifest
Here's an example of a simple Pod manifest:
Explanation
- apiVersion: Specifies the version of the API used (v1 in this case).
- kind: Defines the object type, which is a
Pod. - metadata: Contains
namespecifying the Pod's name andlabelsproviding additional metadata. - spec: Describes the container configurations inside the Pod. Here, it specifies a single container using the Nginx image, exposing port 80.
Applying a Manifest
To apply a manifest file, you can use the kubectl apply command followed by the -f flag with your file name:
This command directs Kubernetes to create the resources defined in the manifest or update them if they already exist.
Standard Kubernetes Manifests
Below is a table summarizing common types of Kubernetes objects typically specified through Manifests:
| Object Type | Purpose | Spec Details Example |
| Pod | Smallest unit of deployment | Containers, Ports |
| Service | Expose Pods as network service | Type, Selector, Ports |
| Deployment | Manages Pods/ReplicaSets | Replicas, Selector, Template |
| ConfigMap | Config data for Pods | Data, BinaryData |
| Secret | Store sensitive information | Data for encoded values |
| PersistentVolumeClaim(PVC) | Request storage | Storage size, Access modes |
Advanced Topics
Managing Environments with ConfigMaps and Secrets
Using ConfigMaps and Secrets allows you to decouple configuration artifacts from image content, making applications portable. A ConfigMap stores simple, non-sensitive configuration like URLs, while Secrets store sensitive data like passwords.
Using Helm for Managing Manifests
Helm is a Kubernetes package manager that helps in templating Kubernetes Manifests and managing releases of applications. Instead of writing separate YAML files for different environments, Helm allows you to template your Manifests and manage them efficiently.
Manifest Lifecycle
Changes to a Manifest are monitored by the Kubernetes Control Plane. When you update a Manifest, Kubernetes evaluates the differences between the current state and the desired state. If discrepancies exist, it takes action to reconcile the state, making deployments easier and more resilient.
Conclusion
Kubernetes Manifests form the backbone of application configuration within Kubernetes. By clearly defining the desired state of components via YAML or JSON, enterprises and developers can achieve a high degree of automation and reliability. Understanding and leveraging Manifests is essential for anyone aiming to harness the full power of Kubernetes.
Related reading
- What is a rollout in Kubernetes?
- What is an 'endpoint' in Kubernetes?
- What is command to find detailed information about Kubernetes masters using kubectl?
- What is docker.io in relation to docker-ce and docker-ee now called Mirantis Kubernetes Engine?
- What is a listener container in Spring for Apache Kafka?
- What is difference between REPLICA and DAEMON service type in Amazon EC2 Container Service?
- What is a provisioning profile used for when developing iPhone applications?
- What is an approach to use multiple different kafka servers in one spring boot app?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.