WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Kubernetes · Advanced · question 48 of 100

Describe the Kubernetes networking model, including the role of the Container Network Interface (CNI) and the use of network plugins.?

📕 Buy this interview preparation book: 100 Kubernetes questions & answers — PDF + EPUB for $5

Kubernetes networking model provides a flat network that enables communication between all the pods in the cluster. It is an essential component that enables different services, containers, and applications to communicate with each other seamlessly. In Kubernetes, the networking model provides a way to communicate between different nodes in the cluster as well as the pods that are running on them.

The Container Network Interface (CNI) is an interface that Kubernetes uses to configure the network of the nodes and the pods running on them. The CNI plugin is responsible for creating a virtual network interface that enables communication between the different pods running in the cluster.

Kubernetes uses network plugins to implement the CNI specification. These plugins provide different networking capabilities, such as network isolation, IP allocation, and load balancing. Some of the commonly used network plugins include Calico, Flannel, Canal, Weave Net, and Cilium. Each network plugin has its own set of features and capabilities, so it is essential to choose the right plugin based on your specific requirements.

Role-Based Access Control (RBAC) is a security feature in Kubernetes that enables administrators to control who can access and modify different resources in the cluster. RBAC can be used to grant or deny permissions to individual users, groups of users, or service accounts. This feature helps ensure that only authorized users have access to sensitive resources in the cluster.

Network Policies are another security feature in Kubernetes that enable administrators to control the flow of network traffic between different pods in the cluster. Network Policies can be used to define rules that specify which pods can communicate with each other and which protocols and ports are allowed. This feature helps ensure that only authorized traffic is allowed between different pods in the cluster.

Pod Security Policies (PSP) is another security feature in Kubernetes that enables administrators to control the security context of pods running in the cluster. PSP can be used to define policies that specify the privileges and capabilities that are available to different pods. This feature helps ensure that the pods running in the cluster are secure and cannot be used to compromise the overall security of the cluster.

Example of creating a Network Policy in Kubernetes:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-nginx-to-db
spec:
  podSelector:
    matchLabels:
      app: db
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: nginx
    ports:
    - protocol: TCP
      port: 3306

This Network Policy specifies that the pods labeled with app: db can only receive incoming traffic from pods labeled with app: nginx on port 3306.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Kubernetes interview — then scores it.
📞 Practice Kubernetes — free 15 min
📕 Buy this interview preparation book: 100 Kubernetes questions & answers — PDF + EPUB for $5

All 100 Kubernetes questions · All topics