https://github.com/hamidgholami/k8s-lab
  
  
    Kubernetes Labratory 
    https://github.com/hamidgholami/k8s-lab
  
cncf devops devops-tools k3s k3s-architecture k3s-cluster k3s-minicluster k8s k8s-cluster k8s-learn kubernetes kubernetes-cluster kubernetes-labs kubernetes-learning sre
        Last synced: 6 months ago 
        JSON representation
    
Kubernetes Labratory
- Host: GitHub
- URL: https://github.com/hamidgholami/k8s-lab
- Owner: hamidgholami
- License: apache-2.0
- Created: 2021-05-23T08:58:11.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-22T10:32:59.000Z (about 2 years ago)
- Last Synced: 2025-04-06T16:49:10.218Z (7 months ago)
- Topics: cncf, devops, devops-tools, k3s, k3s-architecture, k3s-cluster, k3s-minicluster, k8s, k8s-cluster, k8s-learn, kubernetes, kubernetes-cluster, kubernetes-labs, kubernetes-learning, sre
- Language: Jinja
- Homepage:
- Size: 45.9 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
- License: LICENSE
 
Awesome Lists containing this project
README
          # Lightweight Kubernetes Labratory
[](https://twitter.com/geekestan)
[](https://github.com/hamidgholami)
[](https://www.linkedin.com/in/hamid-gholami/)
[](https://www.youtube.com/@geekestan)
This is a 3-node-cluster Kubernetes that uses `k3s`. It can be very usefull for learning Kubernetes concepts easy and fast without struggling with installing kubernetes by `kubeadm` or `minikube`. Although learning methods of Kubernetes installation is definitely crucial, for first step and for learning vital and basic concepts of Kubernetes we need a lightweight and repeatable infrastructure.
#### Requirement
Make sure that following tools are installed on your host.
1. Ansible
2. Vagrant
3. libvirt/KVM or virtualbox
#### SSH configuration
Add the following configuration in `~/.ssh/config`
```bash
Host 10.0.0.*
        Hostname %h
Host 192.168.56.*                     
        Hostname %h
                                               
Match Host 10.0.0.*
        User vagrant                 
        Port 22
        UserKnownHostsFile /dev/null     
        StrictHostKeyChecking no
        PasswordAuthentication no
        IdentityFile $HOME/.vagrant.d/insecure_private_key
        IdentitiesOnly yes                                                                     
        LogLevel FATAL          
                                               
Match Host 192.168.56.*
        User vagrant                                                                           
        Port 22                                                                                
        UserKnownHostsFile /dev/null                                                           
        StrictHostKeyChecking no
        PasswordAuthentication no                                                              
        IdentityFile $HOME/.vagrant.d/insecure_private_key
        IdentitiesOnly yes                                                                     
        LogLevel FATAL
```
#### How does it work?
Fill the variables in `vagrant_variables.yaml` and then execute the following command:
```bash
vagrant up
```
#### Kubeconfig
For executing `kubectl` from your machine rather than in master node (`node-1`), copy the kubectl configuration in your machine:
```
scp vagrant@:~/.kube/config ~/.kube/config
```
#### Changing default storage pool directory
[URL](https://serverfault.com/questions/840519/how-to-change-the-default-storage-pool-from-libvirt)
For changing storage pool default path, the following commands can be used:
```bash
virsh pool-list
virsh pool-destroy default
virsh pool-undefine default
virsh pool-define-as --name default --type dir --target /hdd/pool_ssd_nvm
virsh pool-autostart default
virsh pool-start default
```