0% found this document useful (1 vote)
70 views12 pages

EX280 Demo

EX280 Demo

Uploaded by

jassonroy3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
70 views12 pages

EX280 Demo

EX280 Demo

Uploaded by

jassonroy3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

RedHat

EX280 Exam
Red Hat Certified OpenShift

Questions & Answers


(Demo Version - Limited Content)

Thank you for Downloading EX280 exam PDF Demo

Get Full File:

https://validquestions.com/exam/ex280-questions/
Questions & Answers PDF Page 2

Question: 1

You are tasked with deploying a highly available application in OpenShift. Create a Deployment using
YAML to deploy the nginx container with three replicas, ensuring that it runs successfully. Verify that the
Deployment is active, all replicas are running, and the application can serve requests properly. Provide a
complete walkthrough of the process, including necessary commands to check deployment status.

Answer: See the Solution below.

Solution:

1. Create a Deployment YAML file named nginx-deployment.yaml with the following content:

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:latest
ports:
- containerPort: 80

2. Deploy the file using the command:

kubectl apply -f nginx-deployment.yaml

3. Check the status of the deployment:

kubectl get deployments


kubectl get pods

4. Test the application by exposing the Deployment:

kubectl expose deployment nginx-deployment --type=NodePort --port=80


kubectl get svc

www.validquestions.com
Questions & Answers PDF Page 3

5. Use the NodePort and cluster IP to confirm that the application is serving requests.

Explanation:

Deployments provide a scalable and declarative way to manage applications. YAML manifests ensure
the configuration is consistent, while NodePort services expose the application for testing. Verifying
replicas ensures that the application is running as expected and resilient.

Question: 2

Your team requires an application to load specific configuration data dynamically during runtime. Create
a ConfigMap to hold key-value pairs for application settings, and update an existing Deployment to use
this ConfigMap. Provide a complete YAML definition for both the ConfigMap and the updated
Deployment, and demonstrate how to validate that the configuration is applied correctly.

Answer: See the Solution below.

Solution:

1. Create a ConfigMap YAML file named app-config.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
APP_ENV: production
APP_DEBUG: "false"

2. Apply the ConfigMap using:

kubectl apply -f app-config.yaml

3. Update the Deployment YAML to reference the ConfigMap:

apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deployment
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app

www.validquestions.com
Questions & Answers PDF Page 4

spec:
containers:
- name: app-container
image: nginx:latest
env:
- name: APP_ENV
valueFrom:
configMapKeyRef:
name: app-config
key: APP_ENV
- name: APP_DEBUG
valueFrom:
configMapKeyRef:
name: app-config
key: APP_DEBUG

4. Apply the updated Deployment:

kubectl apply -f app-deployment.yaml

5. Verify the pod environment variables:

kubectl exec -it <pod-name> -- env | grep APP

Explanation:

ConfigMaps decouple configuration data from the application code, enabling environment-specific
settings without altering the deployment logic. Using environment variables from ConfigMaps ensures
flexibility and reduces maintenance complexity.

Question: 3

Perform a rolling update of an application to upgrade the nginx image from 1.19 to 1.21. Ensure zero
downtime during the update and verify that all replicas are running the new version.

Answer: See the Solution below.

Solution:

1. Update the Deployment:

kubectl set image deployment/nginx-deployment nginx=nginx:1.21

2. Monitor the rollout status:

kubectl rollout status deployment/nginx-deployment

3. Verify the updated pods:

www.validquestions.com
Questions & Answers PDF Page 5

kubectl get pods -o wide


kubectl describe pods | grep "nginx:1.21"

Explanation:

Rolling updates replace pods incrementally, ensuring that applications remain available during the
update process. Monitoring confirms the successful rollout.

Question: 4

Deploy an application across multiple namespaces using a common Deployment YAML file. Include
steps to create the namespaces, apply the deployment, and verify that the pods are running in each
namespace.

Answer: See the Solution below.

Solution:

1. Create namespaces:

kubectl create namespace ns1


kubectl create namespace ns2

2. Create a Deployment YAML file app-deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: multi-namespace-app
spec:
replicas: 2
selector:
matchLabels:
app: sample-app
template:
metadata:
labels:
app: sample-app
spec:
containers:
- name: app-container
image: nginx:latest

3. Apply the deployment in each namespace:

kubectl apply -f app-deployment.yaml -n ns1


kubectl apply -f app-deployment.yaml -n ns2

4. Verify the pods:

www.validquestions.com
Questions & Answers PDF Page 6

kubectl get pods -n ns1


kubectl get pods -n ns2

Explanation:

Deploying across namespaces ensures workload isolation while reusing common configurations.
Verification confirms that resources are created and operational.

Question: 5

Configure an Ingress resource to expose an application using a custom domain name. Include steps to
create the Ingress YAML and validate that the domain resolves to the application.

Answer: See the Solution below.

Solution:

1. Create an Ingress YAML file ingress.yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: custom-domain.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app-service
port:
number: 80

2. Apply the Ingress resource:

kubectl apply -f ingress.yaml

3. Update DNS or /etc/hosts to point custom-domain.example.com to the cluster IP.

4. Verify accessibility:

curl http://custom-domain.example.com

Explanation:

www.validquestions.com
Questions & Answers PDF Page 7

Ingress provides an HTTP(S) layer to expose services using custom domains, offering centralized traffic
management.

Question: 6

Configure a StatefulSet to deploy a MySQL database with persistent storage. Include steps to define the
StatefulSet, create a PersistentVolume (PV) and PersistentVolumeClaim (PVC), and verify the database
is running correctly.

Answer: See the Solution below.

Solution:

1. Create a PV YAML file mysql-pv.yaml:

apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data/mysql

2. Create a PVC YAML file mysql-pvc.yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

3. Create a StatefulSet YAML file mysql-statefulset.yaml:

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
spec:
serviceName: "mysql"
replicas: 1
www.validquestions.com
Questions & Answers PDF Page 8

selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:5.7
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: rootpassword
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
volumeClaimTemplates:
- metadata:
name: mysql-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi

4. Apply all YAML files:

kubectl apply -f mysql-pv.yaml


kubectl apply -f mysql-pvc.yaml
kubectl apply -f mysql-statefulset.yaml

5. Verify the StatefulSet and pod:

kubectl get statefulsets


kubectl get pods

Explanation:

StatefulSets ensure stable identities for applications requiring persistent data, like databases. Coupling
them with PVs and PVCs ensures data persistence across restarts.

Question: 7

Diagnose and fix an issue where a Deployment fails due to exceeding the configured ResourceQuota.

Answer: See the Solution below.

www.validquestions.com
Questions & Answers PDF Page 9

Solution:

1. Check the ResourceQuota usage:

kubectl get resourcequota -n <namespace>

2. Review the Deployment resource requests:

kubectl describe deployment <deployment-name>

3. Adjust Deployment resource requests to fit within the quota:

resources:
requests:
cpu: "100m"
memory: "128Mi"

4. Reapply the Deployment:

kubectl apply -f deployment.yaml

Explanation:

ResourceQuotas ensure fair resource distribution. Adjusting Deployment configurations avoids conflicts
and ensures compliance.

Question: 8

Set up and validate OpenShift pod affinity to ensure that pods are scheduled on the same node.

Answer: See the Solution below.

Solution:

1. Update the pod spec with affinity rules:

affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- my-app
topologyKey: "kubernetes.io/hostname"

2. Apply the updated configuration:

www.validquestions.com
Questions & Answers PDF Page 10

kubectl apply -f pod.yaml

3. Verify pod placement:

kubectl get pods -o wide

Explanation:

Pod affinity ensures co-location of related workloads, optimizing resource usage and inter-pod
communication.

Question: 9

Scale an application deployment horizontally to handle increased load.

Answer: See the Solution below.

Solution:

1. Scale the deployment:

kubectl scale deployment nginx-deployment --replicas=5

2. Verify the scaling:

kubectl get pods

Explanation:

Horizontal scaling adds replicas, ensuring applications handle increased traffic effectively.

Question: 10

Update an existing Deployment to add a readiness probe. Validate that the readiness probe works
correctly.

Answer: See the Solution below.

Solution:

1. Update the Deployment YAML to include a readiness probe:

readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 10

www.validquestions.com
Questions & Answers PDF Page 11

2. Apply the updated Deployment:

kubectl apply -f deployment.yaml

3. Verify pod readiness:

kubectl get pods


kubectl describe pod <pod-name>

Explanation:

Readiness probes ensure that only fully initialized and functional pods receive traffic, improving
application reliability.

www.validquestions.com
Thank You for trying EX280 PDF Demo

https://validquestions.com/exam/ex280-questions/

Start Your EX280 Preparation

[Limited Time Offer] Use Coupon " SAVE20 " for extra 20%
discount the purchase of PDF file. Test your
EX280 preparation with actual exam questions

www.validquestions.com

You might also like