0
0
Microservicessystem_design~10 mins

Namespace isolation in Microservices - 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 namespace for service isolation.

Microservices
apiVersion: v1
kind: Namespace
metadata:
  name: [1]
Drag options to blanks, or click blank then click option'
Adefault
Bkube-system
Cpublic
Duser-service
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' namespace which does not isolate services.
2fill in blank
medium

Complete the code to select pods within a specific namespace.

Microservices
kubectl get pods -n [1]
Drag options to blanks, or click blank then click option'
Adefault
Ball
Cuser-service
Dkube-system
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' or 'all' which do not target the specific namespace.
3fill in blank
hard

Fix the error in the YAML to isolate services by namespace.

Microservices
apiVersion: v1
kind: Service
metadata:
  name: payment-service
  namespace: [1]
Drag options to blanks, or click blank then click option'
Akube-system
Bpayment-namespace
Cdefault
Dpayment-service
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' or 'kube-system' namespaces incorrectly.
4fill in blank
hard

Fill both blanks to create a network policy that isolates traffic within a namespace.

Microservices
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-internal
  namespace: [1]
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector: [2]
Drag options to blanks, or click blank then click option'
Apayment-namespace
B{}
Cuser-service
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using podSelector 'null' or a different namespace name.
5fill in blank
hard

Fill all three blanks to define resource quotas for CPU and memory in a namespace.

Microservices
apiVersion: v1
kind: ResourceQuota
metadata:
  name: compute-resources
  namespace: [1]
spec:
  hard:
    requests.cpu: [2]
    requests.memory: [3]
Drag options to blanks, or click blank then click option'
Auser-service
B4
C8Gi
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' namespace or incorrect resource values.