Exam CKS Topic 2 Question 28 Discussion
Actual exam question for Linux Foundation's CKS exam
Question #: 28
Topic #: 2
Question #: 28
Topic #: 2
You are running a Kubernetes cluster in AWS with a workload that involves sensitive data processing. You suspect that some of your pods might be compromised and are leaking data to an external server. You need to identify the compromised pods and isolate them from the network. Explain the steps you would take to achieve this, including the tools and techniques you would use to monitor network traffic, identify suspicious activity, and isolate compromised pods.
Suggested Answer:
Solution (Step by Step):
1. Enable Network Policy: Start by enabling network policies in your Kubernetes cluster. This will restrict network traffic between pods based on predefined rules.
Implementation:

2. Monitor Network Traffic with tools like: Kubernetes Network Policy: Analyze the network policies configured on your cluster to identify any potentially suspicious traffic patterns. Kube-Proxy: Use 'kubectl proxy' to monitor the network traffic within your cluster. Observe incoming and outgoing traffic to identify any unusual patterns. Network Security Monitoring Tools: Consider using dedicated network security monitoring tools like Suricata, Zeek, or tcpdump for more comprehensive network analysis. Implementation: bash kubectl proxy --port=8001 # Start kubectl proxy # In a separate terminal, run the following command to view traffic to a specific pod: curl -v http://localhost.'8001/api/v1/namespaces/default/pods//proxy/ # Analyze the output to identify suspicious traffic. 3. Analyze Logs for Suspicious Activity: Kubernetes Logs: I-Ise tools like ' kubectl logs to inspect the logs of your pods, especially those related to data processing. Look for signs of unauthorized access, data exfiltration attempts, or unusual activity patterns. Security Logging: Configure your cluster to collect security-related events and logs in a centralized logging system like Elasticsearch, Fluentd, and Kibana (EFK) stack. Security Monitoring Tools: Employ tools like Falco or Auditd to actively monitor and analyze security-related events within your Kubernetes cluster. Implementation: bash kubectl logs -f # View logs of the pod 4. Isolate Compromised Pods: Network Segmentation: Use network policies to restrict the network access of suspected pods. Pod Disruption Budget (PDB): Ensure that your workload doesn't become unavailable during the isolation process. Service Disruption: If the compromised pod belongs to a service, consider temporarily removing it from the service's endpoint list to isolate the compromised service instance. Implementation:

5. Investigate and Remediate: Root Cause Analysis: Once the compromised pod is isolated, perform a thorough analysis to determine the cause of the compromise. This may involve examining system logs, network traffic, and potentially performing forensic analysis on the compromised pod Security Remediation: Address the root cause of the compromise by patching vulnerabilities, updating security configurations, and nardening your systems. Recovery and Restoration: If necessary, recover data that may have been leaked and restore your system to a secure state. Implementation: bash # Investigate the cause of the compromise: kubectl logs -f # Analyze the network traffic related to the pod using kubectl proxy and network monitoring tools. # Remediate the compromise: kubectl delete pod # Replace with the name of the compromised pod # Update security configurations # Patch vulnerabilities # Consider using a new container image with updated security measures # Restore data if necessary
1. Enable Network Policy: Start by enabling network policies in your Kubernetes cluster. This will restrict network traffic between pods based on predefined rules.
Implementation:

2. Monitor Network Traffic with tools like: Kubernetes Network Policy: Analyze the network policies configured on your cluster to identify any potentially suspicious traffic patterns. Kube-Proxy: Use 'kubectl proxy' to monitor the network traffic within your cluster. Observe incoming and outgoing traffic to identify any unusual patterns. Network Security Monitoring Tools: Consider using dedicated network security monitoring tools like Suricata, Zeek, or tcpdump for more comprehensive network analysis. Implementation: bash kubectl proxy --port=8001 # Start kubectl proxy # In a separate terminal, run the following command to view traffic to a specific pod: curl -v http://localhost.'8001/api/v1/namespaces/default/pods//proxy/ # Analyze the output to identify suspicious traffic. 3. Analyze Logs for Suspicious Activity: Kubernetes Logs: I-Ise tools like ' kubectl logs to inspect the logs of your pods, especially those related to data processing. Look for signs of unauthorized access, data exfiltration attempts, or unusual activity patterns. Security Logging: Configure your cluster to collect security-related events and logs in a centralized logging system like Elasticsearch, Fluentd, and Kibana (EFK) stack. Security Monitoring Tools: Employ tools like Falco or Auditd to actively monitor and analyze security-related events within your Kubernetes cluster. Implementation: bash kubectl logs -f # View logs of the pod 4. Isolate Compromised Pods: Network Segmentation: Use network policies to restrict the network access of suspected pods. Pod Disruption Budget (PDB): Ensure that your workload doesn't become unavailable during the isolation process. Service Disruption: If the compromised pod belongs to a service, consider temporarily removing it from the service's endpoint list to isolate the compromised service instance. Implementation:

5. Investigate and Remediate: Root Cause Analysis: Once the compromised pod is isolated, perform a thorough analysis to determine the cause of the compromise. This may involve examining system logs, network traffic, and potentially performing forensic analysis on the compromised pod Security Remediation: Address the root cause of the compromise by patching vulnerabilities, updating security configurations, and nardening your systems. Recovery and Restoration: If necessary, recover data that may have been leaked and restore your system to a secure state. Implementation: bash # Investigate the cause of the compromise: kubectl logs -f # Analyze the network traffic related to the pod using kubectl proxy and network monitoring tools. # Remediate the compromise: kubectl delete pod # Replace with the name of the compromised pod # Update security configurations # Patch vulnerabilities # Consider using a new container image with updated security measures # Restore data if necessary
by Marjorie at Nov 13, 2025, 07:37 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).