0
0
Kubernetesdevops~10 mins

LoadBalancer 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 create a LoadBalancer 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'
AClusterIP
BLoadBalancer
CNodePort
DExternalName
Attempts:
3 left
💡 Hint
Common Mistakes
Using ClusterIP instead of LoadBalancer for external access
Confusing NodePort with LoadBalancer
2fill in blank
medium

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

Kubernetes
spec:
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: [1]
      targetPort: 8080
Drag options to blanks, or click blank then click option'
A80
B3306
C22
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Using targetPort instead of port
Choosing a port unrelated to the service
3fill in blank
hard

Fix the error in the service type to correctly expose the service externally.

Kubernetes
spec:
  type: [1]
  ports:
    - port: 80
      targetPort: 8080
Drag options to blanks, or click blank then click option'
AExternalName
BClusterIP
CLoadBalancer
DNodePort
Attempts:
3 left
💡 Hint
Common Mistakes
Using ClusterIP or NodePort when LoadBalancer is needed
Confusing ExternalName with LoadBalancer
4fill in blank
hard

Fill both blanks to complete the LoadBalancer service YAML with correct port and protocol.

Kubernetes
spec:
  type: LoadBalancer
  ports:
    - protocol: [1]
      port: [2]
      targetPort: 8080
Drag options to blanks, or click blank then click option'
ATCP
BUDP
C80
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Using UDP for HTTP services
Confusing port and targetPort
5fill in blank
hard

Fill all three blanks to create a LoadBalancer service with selector, port, and protocol.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: my-loadbalancer
spec:
  type: LoadBalancer
  selector:
    app: [1]
  ports:
    - protocol: [2]
      port: [3]
      targetPort: 8080
Drag options to blanks, or click blank then click option'
AMyApp
BTCP
C80
DNodePort
Attempts:
3 left
💡 Hint
Common Mistakes
Using NodePort as protocol
Mismatching selector label
Using wrong port number