exam questions

Exam CKA All Questions

View all questions & answers for the CKA exam

Exam CKA topic 1 question 6 discussion

Actual exam question from CNCF's CKA
Question #: 6
Topic #: 1
[All CKA Questions]

SIMULATION -


Task -
Reconfigure the existing deployment front-end and add a port specification named http exposing port 80/tcp of the existing container nginx.
Create a new service named front-end-svc exposing the container port http.
Configure the new service to also expose the individual Pods via a NodePort on the nodes on which they are scheduled.

Show Suggested Answer Hide Answer
Suggested Answer:






Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Hamiltonian
Highly Voted 2 years, 1 month ago
if you add port, name, and protocol in the deployment spec, then you only need to run: kubectl expose deployment front-ed--type=NodePort --name=front-end-svc
upvoted 16 times
...
yorkicurke
Highly Voted 2 months, 3 weeks ago
for reconfiguring part ; #kubectl edit deployment front-end then add the following in the container part; containers: - name: nginx-dep-cont image: nginx:1.14.2 ports: - name: http containerPort: 80 protocol: TCP and to Finally expose it; ## kubectl expose deployment front-end --name front-end-svc --target-port http --type=NodePort extra steps; # kubectl describe svc front-end-svc ## curl PICK-ANY-IP-FROM-ENDPOINTS:80 in my case # curl 192.168.133.201:80 Tested!
upvoted 8 times
...
137eceb
Most Recent 2 months, 1 week ago
tcp is default. It will add it automatically.
upvoted 1 times
...
Elvi13
6 months, 3 weeks ago
after editing the existing ,kubectl expose deployment front-end --name=front-end-svc --port=80 --target-port=80 --type=NodePort
upvoted 2 times
...
Ayxanus0610
10 months, 1 week ago
kubectl config use-context k8s kubectl expose deployment front-end --port=80 --target-port=80 --protocol=TCP --type=NodePort --name=front-end-svc with this solution it is much more easier
upvoted 3 times
...
AWS_cert2023
1 year ago
1 kubectl edit deploy front-end ports: - containerPort: 80 name: http 2 apiVersion: v1 kind: Service metadata: name: svc1 spec: selector: app: nginx ports: - name: name-of-service-port protocol: TCP port: 80 targetPort: http 3 apiVersion: v1 kind: Service metadata: name: svc2 type: NodePort selector: app: nginx ports: - port: 80 targetPort: http nodePort: 30007
upvoted 1 times
...
Alencar_07
1 year ago
which this one makes you think more than you need to answer. When asked to export (http) you can put a flag - name: http : example: ports: - container port: 80 name: http However, when you create the service and export port 80 from it.
upvoted 1 times
...
Samm1
1 year, 4 months ago
The question as I understood: kubectl create deployment front-end --image=nginx --replicas=1 --dry-run=client -oyaml > dep1.yaml kubectl apply -f dep1.yaml vi dep1.yaml # manually add the name: http and containerPort: 80 kubectl expose deployment front-end --target-port=http --name=front-end-svc --type=ClusterIP/NodePort --dry-run=client -oyaml>svc1.yaml kubectl apply -f svc1.yaml kubectl describe svc front-end-svc
upvoted 2 times
...
real111
1 year, 5 months ago
I dont realy understand if we need to do two or three actions- 1.reconfigure the yaml file - add ports. 2 create sa and 3. edit service adding type Nodeport or is it ok just reconfigure yaml and run k expose deployment front-end --name front-end-svc --type NodePort --port 80 --target-port HTTP ?
upvoted 2 times
iiiaz
1 year, 5 months ago
This is what I asked too. Search here for my user "iiiaz". But I think for your comment at action 2 is not sa (service account) but svc (service). I guess there are 3 actions but can LinuxFoundation tell if you first done action 2 (create service) and then action 3 (change this service type to NodePort)? As you can directly create a service type NodePort.
upvoted 1 times
...
...
iiiaz
1 year, 5 months ago
Who can explain the difference between these tasks: "T1. Create a new service named front-end-svc exposing the container port http. T2. Configure the new service to also expose the individual Pods via a NodePort on the nodes on which they are scheduled." Is it T1: first expose the deployment as default (service type ClusterIP is created) on port http? Then, T2, edit the service from type ClusterIP to type NodePort? I see the solutions mentioned here go directly to task 2. Quite confusing question.
upvoted 1 times
...
mrallrounder123453656
1 year, 7 months ago
This. is more align with the question k expose deployment front-end --name front-end-svc --type NodePort --port 80 --target-port HTTP
upvoted 7 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago