Skip to content

jenciso/ansible-kubeadm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Playbook to provision kubeadm

Provision VM's

./new-vm.sh -n k8s-master -m 2048 -c 2 -i 192.168.122.100
./new-vm.sh -n k8s-node01 -m 2048 -c 2 -i 192.168.122.101

Pre-install cluster using a playbook:

ansible-playbook site.yml -i inventory

Configure the control plane:

ssh [email protected]
sudo su - 
kubeadm init --pod-network-cidr=172.18.0.0/16 --apiserver-advertise-address $(hostname -i)

Setup your credential:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install calico networking provider

curl -sSL -o calico.yaml https://docs.projectcalico.org/v3.10/manifests/calico.yaml
sed -i -e 's#value: "192.168.0.0/16"#value: "172.18.0.0/16"#' calico.yaml
kubectl apply -f calico.yaml

Verify:

kubectl get nodes
kubectl get pods --all-namespaces
kubectl get pods --all-namespaces -o wide

NOTES

If you need to get the token bootstrap in order to join another node in the cluster, use this command:

kubeadm token create --print-join-command

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages