Complete the code to define a namespace for service isolation.
apiVersion: v1
kind: Namespace
metadata:
name: [1]The namespace name should be unique to isolate the user-service.
Complete the code to select pods within a specific namespace.
kubectl get pods -n [1]To list pods in the user-service namespace, use '-n user-service'.
Fix the error in the YAML to isolate services by namespace.
apiVersion: v1
kind: Service
metadata:
name: payment-service
namespace: [1]The namespace field must match the namespace where the service is deployed, here 'payment-namespace'.
Fill both blanks to create a network policy that isolates traffic within a namespace.
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-internal namespace: [1] spec: podSelector: {} policyTypes: - Ingress ingress: - from: - podSelector: [2]
The network policy applies to 'payment-namespace' and allows ingress from all pods (empty podSelector {}).
Fill all three blanks to define resource quotas for CPU and memory in a namespace.
apiVersion: v1 kind: ResourceQuota metadata: name: compute-resources namespace: [1] spec: hard: requests.cpu: [2] requests.memory: [3]
The resource quota is set for the 'user-service' namespace with CPU requests limited to 4 cores and memory to 8Gi.