0
0
Kubernetesdevops~10 mins

Why Services provide stable networking in Kubernetes - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a Kubernetes Service that exposes pods on port 80.

Kubernetes
kubectl expose pod mypod --port=[1] --target-port=8080
Drag options to blanks, or click blank then click option'
A8080
B80
C443
D3000
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing target port with service port
Using pod port instead of service port
2fill in blank
medium

Complete the code to select pods with label app=web for the Service.

Kubernetes
kubectl expose pod mypod --port=80 --selector=[1]
Drag options to blanks, or click blank then click option'
Aapp=web
Bapp:web
Capp_web
Dweb=app
Attempts:
3 left
💡 Hint
Common Mistakes
Using colon instead of equals
Swapping key and value
3fill in blank
hard

Fix the error in the Service YAML to ensure stable networking by specifying the correct type.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: myservice
spec:
  selector:
    app: myapp
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
  type: [1]
Drag options to blanks, or click blank then click option'
AClusterIP
BNodePort
CExternalName
DLoadBalancer
Attempts:
3 left
💡 Hint
Common Mistakes
Using NodePort when internal stability is needed
Using ExternalName which is for DNS aliasing
4fill in blank
hard

Fill both blanks to complete the Service YAML that ensures stable networking and selects pods correctly.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: stable-service
spec:
  type: [1]
  selector:
    app: [2]
  ports:
  - port: 80
    targetPort: 8080
Drag options to blanks, or click blank then click option'
AClusterIP
BNodePort
Cmyapp
Dwebapp
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong service type
Selector not matching pod labels
5fill in blank
hard

Fill all three blanks to create a Service YAML that provides stable networking, selects pods, and exposes port 80.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: [1]
spec:
  type: [2]
  selector:
    app: [3]
  ports:
  - port: 80
    targetPort: 8080
Drag options to blanks, or click blank then click option'
Astable-service
BClusterIP
Cmyapp
DNodePort
Attempts:
3 left
💡 Hint
Common Mistakes
Using NodePort instead of ClusterIP
Incorrect selector label
Missing service name