← Back to Blog

Manifest in Openshift

Manifest in Openshift Creating a "manifest" for an application in OpenShift: A manifest in OpenShift usually refers to the configuration files used to define and manage Kubernetes resources (like Pods, Deployments, Services, etc.).

Manifest in Openshift

manifest in openshift 1

Creating a "manifest" for an application in OpenShift:

A manifest in OpenShift usually refers to the configuration files used to define and manage Kubernetes resources (like Pods, Deployments, Services, etc.). These files are typically written in YAML or JSON format.

Here's a basic guide on how to create a manifest for a simple application deployment in OpenShift.

1. Creating a Deployment Manifest

A deployment manifest defines the desired state for your application, including how many replicas of your application should be running, the container image to use, and any environment variables or configuration needed.

Here's an example YAML manifest for deploying a simple Nginx application:

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.21.1
ports:
- containerPort: 80

2. Creating a Service Manifest

The service manifest exposes your deployment so that it can be accessed internally or externally.

Example:

apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer

3. Creating a Route Manifest (Optional)

If you want to expose your service to the outside world via an HTTP route (a feature specific to OpenShift), you can create a route manifest.

Example:

apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: nginx-route
spec:
to:
kind: Service
name: nginx-service
port:
targetPort: 80

4. Applying the Manifests

Once you've created your YAML files, you can apply them to your OpenShift cluster using the oc command-line tool:

oc apply -f deployment.yaml
oc apply -f service.yaml
oc apply -f route.yaml

5. Checking the Status

After applying the manifests, you can check the status of your resources using:

oc get deployments
oc get services
oc get routes

This will show you whether your application has been deployed correctly and is accessible.

6. Best Practices

  • Namespace Segregation: Always deploy resources within a specific namespace to avoid conflicts.

  • Resource Limits: Define resource limits and requests (CPU/Memory) to ensure fair usage of cluster resources.

  • ConfigMaps and Secrets: Store configurations and sensitive data like passwords using ConfigMaps and Secrets.

Conclusion

This is a basic overview of creating manifests in OpenShift. Depending on your application, you may need more complex configurations like Persistent Volumes, StatefulSets, etc. OpenShift’s documentation is a great resource for deeper exploration.


Imported from rifaterdemsahin.com · 2025