☢ this repo based in a itwonderland lab, thanks for it https://www.itwonderlab.com
-
Repository contains a playbook for kubernetes cluster easy installation based in Centos 8.
-
You can prepare virtual machines with a Vagrant.
Minimun requisites for node
| node | cpu | memory |
|---|---|---|
| master | 2vcore | 2048mb |
| worker | 1vcore | 2048mb |
Install requisite - Ansible and ansible.posix
ansible-galaxy collection install ansible.posix
- Create ansible user
sudo adduser ansible
sudo passwd ansible
- Generate ssh key, path "~/.ssh/id_rsa.pub"
su - ansible
mkdir .ssh && cd .ssh
ssh-keygen -t rsa
cat id.rsa.pub ## paste inside ssh_prepare_node.sh << PASTE PUBLIC_KEY
-
Copy the public key in
prepare_nodes\prepare_nodes.shshow it for more info. -
Execute the script
prepare_nodes.shon kubernetes for each one k8s node.
This script create a ansible user and add the ssh key inside .ssh/authorized_keys.
- Check and modify the file
inventoryand add your ip nodes
file: inventory
[master]
master-node ansible_host=192.168.205.212
[workers]
worker-node1 ansible_host=192.168.205.211
worker-node2 ansible_host=192.168.205.212
- Check a defaut vars
file: edit.vars.yml
master_admin_user: "ansible"
master_admin_group: "ansible"
master_apiserver_advertise_address: "192.168.205.210"
master_pod_network_cidr: "192.168.112.0/20"
master_node_name: "k8s-m"
node_node_name: "k8s-n"
cluster_name: "k8s-cluster"
# Check the last version https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
dashboard_version: "v2.5.0"
- How run a playbook
Mark or desmark role
---
- import_playbook: roles/deploy-k8s-nodes.yml
#- import_playbook: roles/deploy-dashboard.yml
Run
ansible-playbook run.me.yml -v
Copy KUBECONFIG to local:
scp ansible@master-node:/home/ansible/.kube/config ~/.kube/config
Access to dashboard:
https://master-node:30002/#/login
You find the token inside roles/k8s-cluster-dash_token-join-command.
Add ROLES label to workers nodes:
kubectl label node worker-node1 node-role.kubernetes.io/worker=worker
kubectl label node worker-node2 node-role.kubernetes.io/worker=worker
- ✅ deploy dashboard
- ☐ enable and configure firewall
- ☐ istio deployment
