Skip to content

lmontanag/k8s-cka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Install K8S cluster using vagrant and ansible

based on Kubernetes Setup Using Ansible and Vagrant

Install vagrant & vagrant-vbguest plugin

brew install vagrant
vagrant plugin install vagrant-vbguest

Install ansible on a virtual environment

# create a python virtual environment
python3 -m venv ~/.venv-ansible
# activate environment
source ~/.venv-ansible/bin/activate
# install ansible
pip install ansible
# deactivate environment
deactivate

Starts and provisions the vagrant environment

# activate environment
source ~/.venv-ansible/bin/activate
vagrant up

Access to the servers

## Accessing master
vagrant ssh k8s-master
vagrant@k8s-master:~$ kubectl get nodes
NAME         STATUS   ROLES                  AGE   VERSION
k8s-master   Ready    control-plane,master   20h   v1.21.5
node-1       Ready    <none>                 19h   v1.21.5
node-2       Ready    <none>                 19h   v1.21.5


## Accessing nodes
vagrant ssh node-1
vagrant ssh node-2

additional vagrant commands

resume          resume a suspended vagrant machine
suspend         suspends the machine
status          outputs status of the vagrant machine

useful links

Configuring a cgroup driver

Both the container runtime and the kubelet have a property called "cgroup driver", which is important for the management of cgroups on Linux machines.

Warning: Matching the container runtime and kubelet cgroup drivers is required or otherwise the kubelet process will fail.

See Configuring a cgroup driver for more details.

here the info to setup a cgroup driver for docker

Troubleshooting

  • Running Ansible Manually

    # run master-playbook.yml
    ansible-playbook --private-key=~/.vagrant.d/insecure_private_key --extra-vars "node_ip=192.168.50.10" -u vagrant -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory kubernetes-setup/master-playbook.yml
    # run unly join-command
    ansible-playbook --private-key=~/.vagrant.d/insecure_private_key --extra-vars "node_ip=192.168.50.10" -u vagrant -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory kubernetes-setup/master-playbook.yml --tags "join-command"
  • troubleshoot kubelet

    If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
    - 'systemctl status kubelet'
    - 'journalctl -xeu kubelet'
  • Troubleshooting kubeadm

About

K8S cluster to study for CKA exam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published