Kubernetes Networking & Service Discovery

    Question 1KUBERNETES- Cluster Networking Basics

    In Kubernetes, what is the main principle of cluster networking?

    Question 2KUBERNETES- Service Types

    Which Kubernetes Service type exposes an application externally with a cloud provider’s load balancer?

    Question 3KUBERNETES- Code Snippet (NodePort Service)

    What does this YAML define?

    apiVersion: v1 kind: Service metadata: name: myapp-service spec: type: NodePort selector: app: myapp ports: - port: 80 targetPort: 8080 nodePort: 30007

    Question 4KUBERNETES- DNS Service Discovery

    How do pods discover other services in Kubernetes?

    Question 5KUBERNETES- Ingress Purpose

    What is the main role of an Ingress in Kubernetes?

    Question 6KUBERNETES- Code Snippet (Ingress Example)

    What is the function of this YAML snippet?

    apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: myapp-ingress spec: rules: - host: myapp.example.com http: paths: - path: / pathType: Prefix backend: service: name: myapp-service port: number: 80

    Question 7KUBERNETES- Network Policies

    What is the purpose of a NetworkPolicy in Kubernetes?

    Question 8KUBERNETES- Code Snippet (Simple NetworkPolicy)

    What does this NetworkPolicy allow?

    apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend spec: podSelector: matchLabels: role: backend ingress: - from: - podSelector: matchLabels: role: frontend

    Question 9KUBERNETES- Headless Services

    What is a headless service in Kubernetes?

    Question 10KUBERNETES- Port Mapping in Services

    In a Service YAML, what does targetPort define?