U.S. Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation CKAD Exam - Topic 6 Question 32 Discussion

Refer to Exhibit.Set Configuration Context:[student@node-1] $ | kubectlConfig use-context k8sContextA container within the poller pod is hard-coded to connect the nginxsvc service on port 90 . As this port changes to 5050 an additional container needs to be added to the poller pod which adapts the container to connect to this new port. This should be realized as an ambassador container within the pod.Task* Update the nginxsvc service to serve on port 5050.* Add an HAproxy container named haproxy bound to port 90 to the poller pod and deploy the enhanced pod. Use the image haproxy and inject the configuration located at /opt/KDMC00101/haproxy.cfg, with a ConfigMap named haproxy-config, mounted into the container so that haproxy.cfg is available at /usr/local/etc/haproxy/haproxy.cfg. Ensure that you update the args of the poller container to connect to localhost instead of nginxsvc so that the connection is correctly proxied to the new service endpoint. You must not modify the port of the endpoint in poller's args . The spec file used to create the initial poller pod is available in /opt/KDMC00101/poller.yaml
A) Explanation: Solution: To update the nginxsvc service to serve on port 5050, you will need to edit the service's definition yaml file. You can use the kubectl edit command to edit the service in place. kubectl edit svc nginxsvc This will open the service definition yaml file in your default editor. Change the targetPort of the service to 5050 and save the file. To add an HAproxy container named haproxy bound to port 90 to the poller pod, you will need to edit the pod's definition yaml file located at /opt/KDMC00101/poller.yaml. You can add a new container to the pod's definition yaml file, with the following configuration: containers: - name: haproxy image: haproxy ports: - containerPort: 90 volumeMounts: - name: haproxy-config mountPath: /usr/local/etc/haproxy/haproxy.cfg subPath: haproxy.cfg args: ['haproxy', '-f', '/usr/local/etc/haproxy/haproxy.cfg'] This will add the HAproxy container to the pod and configure it to listen on port 90. It will also mount the ConfigMap haproxy-config to the container, so that haproxy.cfg is available at /usr/local/etc/haproxy/haproxy.cfg. To inject the configuration located at /opt/KDMC00101/haproxy.cfg to the container, you will need to create a ConfigMap using the following command: kubectl create configmap haproxy-config --from-file=/opt/KDMC00101/haproxy.cfg You will also need to update the args of the poller container so that it connects to localhost instead of nginxsvc. You can do this by editing the pod's definition yaml file and changing the args field to args: ['poller','--host=localhost']. Once you have made these changes, you can deploy the updated pod to the cluster by running the following command: kubectl apply -f /opt/KDMC00101/poller.yaml This will deploy the enhanced pod with the HAproxy container to the cluster. The HAproxy container will listen on port 90 and proxy connections to the nginxsvc service on port 5050. The poller container will connect to localhost instead of nginxsvc, so that the connection is correctly proxied to the new service endpoint. Please note that, this is a basic example and you may need to tweak the haproxy.cfg file and the args based on your use case.

Linux Foundation CKAD Exam - Topic 6 Question 32 Discussion

Actual exam question for Linux Foundation's CKAD exam
Question #: 32
Topic #: 6
[All CKAD Questions]

Refer to Exhibit.

Set Configuration Context:

[student@node-1] $ | kubectl

Config use-context k8s

Context

A container within the poller pod is hard-coded to connect the nginxsvc service on port 90 . As this port changes to 5050 an additional container needs to be added to the poller pod which adapts the container to connect to this new port. This should be realized as an ambassador container within the pod.

Task

* Update the nginxsvc service to serve on port 5050.

* Add an HAproxy container named haproxy bound to port 90 to the poller pod and deploy the enhanced pod. Use the image haproxy and inject the configuration located at /opt/KDMC00101/haproxy.cfg, with a ConfigMap named haproxy-config, mounted into the container so that haproxy.cfg is available at /usr/local/etc/haproxy/haproxy.cfg. Ensure that you update the args of the poller container to connect to localhost instead of nginxsvc so that the connection is correctly proxied to the new service endpoint. You must not modify the port of the endpoint in poller's args . The spec file used to create the initial poller pod is available in /opt/KDMC00101/poller.yaml

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Alishia
7 months ago
I'm surprised they didn't mention updating the poller args earlier.
upvoted 0 times
...
Gabriele
7 months ago
HAproxy is a solid choice for this setup!
upvoted 0 times
...
Man
7 months ago
Wait, why do we need an ambassador container? Seems unnecessary.
upvoted 0 times
...
Tayna
8 months ago
Totally agree, that's the way to go!
upvoted 0 times
...
Elmer
8 months ago
Just edit the service with `kubectl edit svc nginxsvc` to change the port.
upvoted 0 times
...
Gussie
8 months ago
I definitely remember needing to change the args for the poller container, but I can't recall if we used localhost or something else in our practice.
upvoted 0 times
...
Amber
8 months ago
I feel a bit confused about the ConfigMap part. Did we cover how to mount it properly in the container?
upvoted 0 times
...
Paulene
8 months ago
I think we did a similar question where we had to add a container to a pod. I hope I can recall the correct syntax for the YAML file.
upvoted 0 times
...
Weldon
8 months ago
I remember we practiced updating service ports, but I'm not entirely sure how to edit the service definition directly.
upvoted 0 times
...
Tracie
8 months ago
No problem, I've done stuff like this before. I'll update the service, create the ConfigMap, and add the HAproxy container. Updating the poller args should be straightforward.
upvoted 0 times
...
Nu
8 months ago
Whoa, this is a lot of moving parts. I better make sure I don't miss any details. Updating the service, creating the ConfigMap, and modifying both containers - I'll need to stay organized.
upvoted 0 times
...
Howard
8 months ago
Okay, let's see. I think I understand the main tasks - update the service, add the HAproxy container, and modify the poller container. I'll need to reference the YAML files and ConfigMap closely.
upvoted 0 times
...
Rolland
9 months ago
Hmm, this looks like a tricky one. I'll need to carefully read through the requirements and plan out my steps before diving in.
upvoted 0 times
...
Loren
9 months ago
I'm a bit confused by the wording of this question. Is it asking about the properties or characteristics of a flow port that's linked to a flow specification? I'll have to re-read it a few times.
upvoted 0 times
...
Ashlee
9 months ago
Hmm, I'm a bit confused about the relationship between Bharat Medicals and Maurya Logistics. Do they have equal responsibilities when it comes to consumer data protection?
upvoted 0 times
...
Arminda
9 months ago
Hmm, I'm not sure about the different roles and responsibilities here. Let me think this through carefully.
upvoted 0 times
...
Sheridan
9 months ago
Hmm, I'm a bit confused on how to approach this. I know it's about probabilities, but I'm not sure how to calculate the probability of no defects given the individual probabilities of the two defect types.
upvoted 0 times
...
Leanora
1 year ago
Ah, the joys of working with Kubernetes. At least it's not a 'write a new YAML from scratch' question. That would be a real head-scratcher!
upvoted 0 times
Alberta
1 year ago
Tran: True, the satisfaction of solving a Kubernetes puzzle is unmatched.
upvoted 0 times
...
Tran
1 year ago
User 2: Definitely, but it's always a good feeling when you figure it out.
upvoted 0 times
...
Arlene
1 year ago
User 1: I know right, working with Kubernetes can be challenging sometimes.
upvoted 0 times
...
...
Earleen
1 year ago
Alright, time to put my Kubernetes ninja skills to the test! I bet the exam writers are chuckling at us trying to figure this out.
upvoted 0 times
Celestina
1 year ago
Agreed, let's tackle this task step by step and show those exam writers what we're made of!
upvoted 0 times
...
Rosendo
1 year ago
Definitely! Let's follow the steps provided and we'll have that pod updated in no time.
upvoted 0 times
...
Keva
1 year ago
I know right, Kubernetes can be tricky sometimes. But we got this!
upvoted 0 times
...
...
Ozell
1 year ago
Wait, so we have to edit the pod and service YAML files directly? No kubectl commands to do this? That's a bit old-school, but I guess it gets the job done.
upvoted 0 times
Breana
1 year ago
It may seem old-school, but it's a reliable way to make the necessary changes.
upvoted 0 times
...
Marjory
1 year ago
Yes, you need to edit the pod and service YAML files directly for this task.
upvoted 0 times
...
Justine
1 year ago
It may seem old-school, but it's a reliable way to make the necessary changes.
upvoted 0 times
...
Sherell
1 year ago
Yes, you need to edit the pod and service YAML files directly for this task.
upvoted 0 times
...
...
Elroy
1 year ago
The solution provided explains how to update the service and add the HAproxy container with the necessary configuration. We should follow those steps.
upvoted 0 times
...
Catalina
1 year ago
Yes, we need to add an HAproxy container named haproxy bound to port 90 to the poller pod.
upvoted 0 times
...
Kyoko
1 year ago
Hmm, the ConfigMap injection seems a bit tricky. Hope I don't mess up the haproxy.cfg file. Fingers crossed it all works as expected!
upvoted 0 times
...
Elroy
1 year ago
I think the task is asking us to update the nginxsvc service to serve on port 5050.
upvoted 0 times
...
Joanna
1 year ago
Okay, this looks straightforward. Update the service port, add the HAproxy container, and update the poller container's args. Gotta love these 'modify existing resources' tasks!
upvoted 0 times
Sylvie
1 year ago
True, that's an important step to ensure the configuration is injected correctly.
upvoted 0 times
...
Eladia
1 year ago
Don't forget to create the ConfigMap for haproxy-config.
upvoted 0 times
...
Sage
1 year ago
Yeah, it's all about updating configurations and adding new containers.
upvoted 0 times
...
Jeff
1 year ago
Sounds like a fun challenge!
upvoted 0 times
...
...
Sage
1 year ago
The provided solution explanation seems clear and helpful though.
upvoted 0 times
...
Sage
1 year ago
I agree, updating the nginxsvc service and adding an HAproxy container requires attention to detail.
upvoted 0 times
...
Sage
1 year ago
I found the task in the exam quite challenging.
upvoted 0 times
...

Save Cancel