0
0
Kubernetesdevops~10 mins

Ingress vs LoadBalancer Service decision in Kubernetes - Interactive 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
kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  type: [1]
  selector:
    app: my-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
Drag options to blanks, or click blank then click option'
AExternalName
BLoadBalancer
CNodePort
DClusterIP
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing ClusterIP does not expose the service externally.
2fill in blank
medium

Complete the code to define an Ingress resource for routing HTTP traffic.

Kubernetes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: [1]
            port:
              number: 80
Drag options to blanks, or click blank then click option'
Amy-deployment
Bmy-pod
Cmy-node
Dmy-service
Attempts:
3 left
💡 Hint
Common Mistakes
Using pod or node names instead of service names.
3fill in blank
hard

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

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: web-service
spec:
  type: [1]
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 8080
Drag options to blanks, or click blank then click option'
AClusterIP
BNodePort
CLoadBalancer
DHeadless
Attempts:
3 left
💡 Hint
Common Mistakes
Using ClusterIP or NodePort when external load balancer is needed.
4fill in blank
hard

Fill both blanks to create an Ingress rule that routes traffic to the correct service and port.

Kubernetes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app-ingress
spec:
  rules:
  - host: app.example.com
    http:
      paths:
      - path: /app
        pathType: Prefix
        backend:
          service:
            name: [1]
            port:
              number: [2]
Drag options to blanks, or click blank then click option'
Aapp-service
Bbackend-service
C80
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong service name or port number.
5fill in blank
hard

Fill all three blanks to define a LoadBalancer service with the correct selector and port.

Kubernetes
apiVersion: v1
kind: Service
metadata:
  name: [1]
spec:
  type: LoadBalancer
  selector:
    app: [2]
  ports:
    - protocol: TCP
      port: [3]
      targetPort: 8080
Drag options to blanks, or click blank then click option'
Afrontend-service
Bfrontend
C80
Dbackend
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching service name and selector labels.