0
0
Kubernetesdevops~10 mins

ClusterIP service type in Kubernetes - Interactive Code Practice

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

Complete the code to define a ClusterIP service in Kubernetes.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: [1]
  selector:
    app: MyApp
  ports:
  - protocol: TCP
    port: 80
    targetPort: 9376
Drag options to blanks, or click blank then click option'
ANodePort
BClusterIP
CExternalName
DLoadBalancer
Attempts:
3 left
💡 Hint
Common Mistakes
Using NodePort or LoadBalancer when only internal access is needed.
Confusing ExternalName with ClusterIP.
2fill in blank
medium

Complete the code to specify the port that the ClusterIP service listens on.

Kubernetes
spec:
  ports:
  - protocol: TCP
    port: [1]
    targetPort: 8080
Drag options to blanks, or click blank then click option'
A3000
B443
C8080
D80
Attempts:
3 left
💡 Hint
Common Mistakes
Setting port to targetPort value instead of the service port.
Using a port number that conflicts with other services.
3fill in blank
hard

Fix the error in the service type to correctly create a ClusterIP service.

Kubernetes
spec:
  type: [1]
Drag options to blanks, or click blank then click option'
AClusterIP
Bclusterip
CclusterIP
DClusterIp
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or incorrect casing for the service type.
Misspelling the service type name.
4fill in blank
hard

Fill both blanks to complete the selector and port configuration for a ClusterIP service.

Kubernetes
spec:
  selector:
    app: [1]
  ports:
  - port: [2]
Drag options to blanks, or click blank then click option'
AMyApp
B80
CYourApp
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Using a selector that does not match any pods.
Setting the port to a value not exposed by the pods.
5fill in blank
hard

Fill all three blanks to define a ClusterIP service with correct type, selector, and port.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: example-service
spec:
  type: [1]
  selector:
    app: [2]
  ports:
  - protocol: TCP
    port: [3]
    targetPort: 8080
Drag options to blanks, or click blank then click option'
AClusterIP
BMyApp
C80
DNodePort
Attempts:
3 left
💡 Hint
Common Mistakes
Using NodePort instead of ClusterIP for internal services.
Mismatching selector labels and pod labels.
Setting port to a value not exposed by pods.