0
0
Kubernetesdevops~10 mins

Path-based routing 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 specify the path for routing in the Ingress rule.

Kubernetes
paths:
  - path: [1]
    pathType: Prefix
    backend:
      service:
        name: my-service
        port:
          number: 80
Drag options to blanks, or click blank then click option'
A/api
Bapi
Chttp://api
D/*
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the leading slash in the path
Using wildcard characters like '*' incorrectly
2fill in blank
medium

Complete the code to set the pathType for prefix-based routing.

Kubernetes
paths:
  - path: /app
    pathType: [1]
    backend:
      service:
        name: app-service
        port:
          number: 8080
Drag options to blanks, or click blank then click option'
AWildcard
BExact
CImplementationSpecific
DPrefix
Attempts:
3 left
💡 Hint
Common Mistakes
Using Exact when prefix matching is needed
Using invalid pathType values
3fill in blank
hard

Fix the error in the Ingress rule by completing the backend service port number.

Kubernetes
rules:
- http:
    paths:
    - path: /web
      pathType: Prefix
      backend:
        service:
          name: web-service
          port:
            number: [1]
Drag options to blanks, or click blank then click option'
A80
Beighty
Chttp
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using protocol names instead of port numbers
Using strings instead of integers for port
4fill in blank
hard

Fill both blanks to complete the Ingress rule for routing /blog and /shop paths to their services.

Kubernetes
rules:
- http:
    paths:
    - path: [1]
      pathType: Prefix
      backend:
        service:
          name: blog-service
          port:
            number: 80
    - path: [2]
      pathType: Prefix
      backend:
        service:
          name: shop-service
          port:
            number: 8080
Drag options to blanks, or click blank then click option'
A/blog
B/store
C/shop
Dblog
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the leading slash
Using incorrect path names
5fill in blank
hard

Fill all three blanks to create a dictionary of paths with their backend service names and ports.

Kubernetes
paths_dict = {
  [1]: {
    "service": [2],
    "port": [3]
  }
}
Drag options to blanks, or click blank then click option'
A"/api"
B"api-service"
C80
D"/app"
Attempts:
3 left
💡 Hint
Common Mistakes
Missing quotes around strings
Using strings for port numbers