Kubernetes the hard way on bare metal/VMs — Setting up POD Networking
Part of the Kubernetes the hard way on bare metal/VM. This is designed for beginners.
Introduction
This guide is part of the Kubernetes the hard way on bare metal/VMs series. On its own this may be useful to you however since it’s tailored for the series, it may not be completely suited to your needs.
Setting up Pod Networking
In Kelsey’s guide, he creates the routing with GCE but you don’t have that luxury with bare metal unfortunately.
In your setup, you have a variety of options available.
As mentioned way back at the start, you’ll be using calico and by the way, we’re back on the lab machine.
Let’s go ahead and grab Calico and then modify it to work with our setup.
curl https://docs.projectcalico.org/manifests/calico-etcd.yaml -o calico.yaml# Set ETCD IPs
sed -i 's/etcd_endpoints:\ "http:\/\/<ETCD_IP>:<ETCD_PORT>"/etcd_endpoints:\ "https:\/\/192.168.0.110:2379,https:\/\/192.168.0.111:2379,https:\/\/192.168.0.112:2379"/g' calico.yaml# Set Certificate data in secret
sed -i "s/# etcd-cert: null/etcd-cert: $(cat pki\/api\/kubernetes.pem | base64 -w 0)/g" calico.yaml
sed -i "s/# etcd-key: null/etcd-key: $(cat pki\/api\/kubernetes-key.pem | base64 -w 0)/g" calico.yaml
sed -i "s/# etcd-ca: null/etcd-ca: $(cat pki\/ca\/ca.pem | base64 -w 0)/g" calico.yaml# Setup Config map with secret information
sed -i "s/etcd_ca: \"\"/etcd_ca: \"\/calico-secrets\/etcd-ca\"/g" calico.yaml
sed -i "s/etcd_cert: \"\"/etcd_cert: \"\/calico-secrets\/etcd-cert\"/g" calico.yaml
sed -i "s/etcd_key: \"\"/etcd_key: \"\/calico-secrets\/etcd-key\"/g" calico.yaml# Setup the POD CIDR ENV
sed -i 's/# - name: CALICO_IPV4POOL_CIDR/- name: CALICO_IPV4POOL_CIDR/g' calico.yaml
sed -i 's/# value: "192.168.0.0\/16"/ value: "10.200.0.0\/16"/g' calico.yaml
Now apply the Calico file.
kubectl apply -f calico.yaml
Now watch it to ensure it starts. If it does not, then check the logs, it’s possible there is an error with an IP or a certificate when you copied the commands above. Ensure you have everything correct to your environment.
kubectl get po -n kube-system -wcalico-kube-controllers-5ff55948c5-9tbrd 1/1 Running 0 37s
calico-node-2v9pq 1/1 Running 0 37s
calico-node-l6gc7 1/1 Running 0 37s
calico-node-t9bk8 1/1 Running 0 37s
Conclusion
You’ve configured the POD networking/routing within the cluster. Only a bit more to go and you’re going to be ready to go on your merry way.
Next: Setting up DNS