CKA Mock exam3 question1

Hi Team,

Kindly assist me in this question. Thanks!

You are an administrator preparing your environment to deploy a Kubernetes cluster using kubeadm. Adjust the following network parameters on the system to the following values, and make sure your changes persist reboots:

net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1

Solution based on the documentation link mentioned below:
Container Runtimes | Kubernetes)-,Enable%20IPv4%20packet%20forwarding,-To%20manually%20enable

# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

# Apply sysctl params without reboot
sudo sysctl --system

If I do like this, will this be correct

# Add this in in /etc/sysctl.conf 
net.ipv4.ip_forward = 1

# sysctl -p 

The grader is being a bit strict, I think, since it will only take the changes from /etc/sysctl.conf. From the solution on the End Exam page:

echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
echo 'net.bridge.bridge-nf-call-iptables = 1' >> /etc/sysctl.conf
sysctl -p

Since going to the docs is a good way to solve this kind of a problem, I’ll ask engineering to allow for your solution as well.

Thanks @rob_kodekloud . I will wait for your response :slight_smile:

Actually, the engineer says your answer should pass. I took the answer you used as a basis, added the second setting (net.bridge.bridge-nf-call-iptables = 1) to it, so it put the change into /etc/sysctl.d/k8s.conf, and in fact, that answer validated. So are you sure you entered both settings into your answer?

Thanks @rob_kodekloud . I just want to confirm both the solutions will work and are correct

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

# Apply sysctl params without reboot
sudo sysctl --system
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
echo 'net.bridge.bridge-nf-call-iptables = 1' >> /etc/sysctl.conf
sysctl -p

I tested 1, and it validated. This may be by accident, since I don’t think the files were actually tested by the grader. But it’s worth trying again I think. Thanks for reporting this.

Thanks @rob_kodekloud , Please close the case.