KI7MT
July 30, 2021, 9:22pm
1
I’m just curious;
Kubernetes has a very high cool factor, and there is no shortage of things to learn. However, my practical side keeps asking the question, what workloads do I “need” Kubernetes for in a Homelab besides learning and testing?
So there’s the question. Aside from training and testing, what types of workloads are you using K3S/K8S for in your Homelab? Is it worth the expense both in terms of time and hardware?
What do you think?
3 Likes
Awesome question,
As I was mowing the lawn this afternoon, I was doing the math: 3 RPIs + SD cards + power supply + … I think I have an old 5 port switch.
Nothing good can come from that line of thinking
Buffy
July 31, 2021, 6:08am
3
TBH, I don’t think it has a use in a homelab beyond learning. Of course, learning can be pretty important (and even fun), so that’s probably enough.
1 Like
KI7MT
July 31, 2021, 6:27am
4
I hadn’t watched @Jay ’s Ansible series, and I’m about half way through it now. After, I’ll “attempt” an HA K3S cluster using a Load Balancer and Rancher. If that goes OK, may do some K8S / Microk8s or something. The only thing that won’t get merc’d on my cluster is TrueNAS.
I’ve already re-built the thing several times manually, and it’s getting tedious to say the least. The other thing I’m considering is creating my own Ubuntu [amd64] Mirror using ( apt-mirror ) for the main repositories. I have saved a partially updated VM as a template, but, I like starting from a fresh install all the way through to a running product; full stack provisioning basically.
That’s the idea I have, we’ll see if I can make it happen. There are many moving parts to that stack.
1 Like
KI7MT
July 31, 2021, 8:52am
5
Well, I ran into my first issue with the Ansible series. For whatever reason, after installing ansible via the Ubuntu repo’s, I was getting the following error
ModuleNotFoundError: No module named ‘ansible’
I use Anaconda Python , PyCharm or VSCode for both work and personal projects, so, i just created a new venv and went to town on it.
# Create the ( lltv ) virtual environment
conda create -n lltv python=3.8
# Activate ( lltv )
conda activate lltv
# Update pip
python -m pip install --upgrade pip
# Install Ansible
pip install ansible
After that, things went as expected.
(lltv) ki7mt@3950X:~/Dev/Ansible/ha-k3s-ansible (master)*$ ansible all -m ping
192.168.1.252 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
192.168.1.250 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
192.168.1.251 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
I’m not sure what the problem with the Ubuntu package installation of Ansible is / was, but, I rarely use the system Python Interpreter just to avoid conflicts like this. The same for Java, Spark and a few others. For those I tend to use Sdkman as it makes swapping version very easy.
Anyway, back to @Jay ’s Ansible series !
1 Like
Were you using the standard ubuntu repo or did you add the ansible ppa? on pop os desktop 21.04 the standard repo worked.
dave@p73:~/projects/infrastructure$ ansible --version
ansible 2.10.5
config file = /home/dave/projects/infrastructure/ansible.cfg
configured module search path = [‘/home/dave/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.9.5 (default, May 11 2021, 08:20:37) [GCC 10.3.0]
It is a bit old, but it works.
When I tried to follow the instructions on the ansible site.
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible
I got a similar error. I don’t think the ppa supports anything newer than ubuntu 18.04. It installs but doesn’t work.
KI7MT
July 31, 2021, 10:06am
7
I was using the standard repos, and did not add the PPA.
Looks like the latest 2.x version only goes to 18.04, but Ansible-3 and Ansible-4 goes up to Groovy (20.10)
Pip installs the 2.x.x series for Python 3.8
ansible [core 2.11.3]
config file = /home/ki7mt/Dev/Ansible/ha-k3s-ansible/ansible.cfg
configured module search path = ['/home/ki7mt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ki7mt/anaconda3/envs/lltv/lib/python3.8/site-packages/ansible
ansible collection location = /home/ki7mt/.ansible/collections:/usr/share/ansible/collections
executable location = /home/ki7mt/anaconda3/envs/lltv/bin/ansible
python version = 3.8.10 (default, Jun 4 2021, 15:09:15) [GCC 7.5.0]
jinja version = 3.0.1
libyaml = True
Launchpad Reference: Ansible Team
# Ansible-3
sudo add-apt-repository ppa:ansible/ansible-3
sudo apt-get update
# Ansible-4
sudo add-apt-repository ppa:ansible/ansible-4
sudo apt-get update
2 Likes
I’ll give ansible-4 a try tomorrow.
For me, first and foremost, learning.
Second, while I don’t require high availability, k3s (RPi) it is nice to have.
I’m not running any pods yet, but my list of apps to host in k3s:
Unifi network controller
pi-hole
Grafana/InfluxDB
ansible
OpenVAS
Nextcloud - maybe
For me, this the start to move from hosting VMs to hosting containers.
2 Likes
KI7MT
July 31, 2021, 6:07pm
10
I’ve only run some simple things like Nginx and played around with scaling pods. I do have some radio projects that could benefit from pods though. Also, learning how to implement CI/CDpiplines.
A couple other things that could be beneficial in K3’s: HashiCorp Vault and Consul in High availability mode for secrets management. Allthough, it’s probably not “needed” for home use, it’s definitely good to know.
This is from their site.
Concept
Design
2 Likes
Buffy
July 31, 2021, 6:26pm
11
I think it’s a bit confusing how ansible reports its versioning. I have it installed with pip and it installs ansible-4.3.0 and also ansible_core-2.11.3.
(venv-ansible) [astrocat@spiff:~/projects/serenity-ansible]
└─➤ $ pip install ansible
Collecting ansible
Downloading ansible-4.3.0.tar.gz (35.1 MB)
|████████████████████████████████| 35.1 MB 29.8 MB/s
Collecting ansible-core<2.12,>=2.11.3
Downloading ansible-core-2.11.3.tar.gz (6.8 MB)
|████████████████████████████████| 6.8 MB 28.9 MB/s
Collecting jinja2
Downloading Jinja2-3.0.1-py3-none-any.whl (133 kB)
|████████████████████████████████| 133 kB 6.0 MB/s
Collecting PyYAML
Downloading PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl (630 kB)
|████████████████████████████████| 630 kB 28.7 MB/s
Collecting cryptography
Downloading cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl (3.2 MB)
|████████████████████████████████| 3.2 MB 28.8 MB/s
Collecting packaging
Downloading packaging-21.0-py3-none-any.whl (40 kB)
|████████████████████████████████| 40 kB 3.1 MB/s
Collecting resolvelib<0.6.0,>=0.5.3
Downloading resolvelib-0.5.4-py2.py3-none-any.whl (12 kB)
Collecting cffi>=1.12
Downloading cffi-1.14.6-cp39-cp39-manylinux1_x86_64.whl (405 kB)
|████████████████████████████████| 405 kB 27.1 MB/s
Collecting pycparser
Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
|████████████████████████████████| 112 kB 4.4 MB/s
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl (30 kB)
Collecting pyparsing>=2.0.2
Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Building wheels for collected packages: ansible, ansible-core
Building wheel for ansible (setup.py) ... done
Created wheel for ansible: filename=ansible-4.3.0-py3-none-any.whl size=57843255 sha256=e48973c5f010784506977587e73f6d1187b976f813b0fcae52afd5cbe55f0777
Stored in directory: /home/astrocat/.cache/pip/wheels/f7/66/b6/f40ca8fb56c13f0e5998b42100a308732989b9b3fa00b8dfef
Building wheel for ansible-core (setup.py) ... done
Created wheel for ansible-core: filename=ansible_core-2.11.3-py3-none-any.whl size=1955103 sha256=6248d3aac5a5a8d73de02fb56ad27a4c015c9961d9408a37ef49a99b42a36823
Stored in directory: /home/astrocat/.cache/pip/wheels/2f/4f/a4/fafba282bc097a86e814d508da21db6fd6f3cd41803d83a928
Successfully built ansible ansible-core
Installing collected packages: pycparser, pyparsing, MarkupSafe, cffi, resolvelib, PyYAML, packaging, jinja2, cryptography, ansible-core, ansible
Successfully installed MarkupSafe-2.0.1 PyYAML-5.4.1 ansible-4.3.0 ansible-core-2.11.3 cffi-1.14.6 cryptography-3.4.7 jinja2-3.0.1 packaging-21.0 pycparser-2.20 pyparsing-2.4.7 resolvelib-0.5.4
(venv-ansible) [astrocat@spiff:~/projects/serenity-ansible]
└─➤ $ ansible --version
ansible [core 2.11.3]
config file = /home/astrocat/projects/serenity-ansible/ansible.cfg
configured module search path = ['/home/astrocat/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/astrocat/projects/serenity-ansible/venv-ansible/lib/python3.9/site-packages/ansible
ansible collection location = /home/astrocat/.ansible/collections:/usr/share/ansible/collections
executable location = /home/astrocat/projects/serenity-ansible/venv-ansible/bin/ansible
python version = 3.9.6 (default, Jun 30 2021, 10:22:16) [GCC 11.1.0]
jinja version = 3.0.1
libyaml = True
(venv-ansible) [astrocat@spiff:~/projects/serenity-ansible]
└─➤ $ which ansible
/home/astrocat/projects/serenity-ansible/venv-ansible/bin/ansible
1 Like
KI7MT
July 31, 2021, 6:42pm
12
That may explain the packaging schema in Launchpad. It is indeed confusing. It would seem that Ansible-Core is just the entry points scripts like ansible-playbook, ansible-docs, etc. Where the Ansible-3 / Ansible-4 packages are plugins / modules to Core.
I’m not well versed in Ansible yet, but, that’s what it looks like from 30,000ft.
1 Like
Buffy
July 31, 2021, 6:48pm
13
Yeah, I think so too. It does work real nice, though! \o/
KI7MT
July 31, 2021, 6:49pm
14
Looking at PyPi Ansible , the released version looks to be 4.3.0
So, one could do, in theory
python pip install ansible=4.3.0
I’ll try that and see how it goes.
1 Like
Buffy
July 31, 2021, 6:50pm
15
If you still have an older one installed, you might get lots of fussing about needing to uninstall the old one first…
KI7MT
July 31, 2021, 6:55pm
16
It installed 4.3.0 by default when I used
pip install ansible
I just did the uninstall and it pulled out 4.3.0.
pip uninstall ansible
# Results
Proceed (Y/n)? y
Successfully uninstalled ansible-4.3.0
(lltv) ki7mt@3950X:~ $
Reinstallation
pip install ansible
then
pip list
(lltv) ki7mt@3950X:~ $ pip list
Package Version
------------ -------------------
ansible 4.3.0
ansible-core 2.11.3
certifi 2021.5.30
cffi 1.14.6
cryptography 3.4.7
Jinja2 3.0.1
MarkupSafe 2.0.1
packaging 21.0
pip 21.2.2
pycparser 2.20
pyparsing 2.4.7
pyspark 3.0.1
PyYAML 5.4.1
resolvelib 0.5.4
setuptools 52.0.0.post20210125
wheel 0.36.2
2 Likes
KI7MT
July 31, 2021, 7:02pm
17
Ok, I created a fresh venv, its definitely pulling ansible-core 2.11.3 and ansible 4.3.0
conda create lltv-1 python=3.8
conda activate lltv-1
then
pip list
(lltv-1) ki7mt@3950X:~ $ pip list
Package Version
---------- -------------------
certifi 2021.5.30
pip 21.1.3
pyspark 3.0.1
setuptools 52.0.0.post20210125
wheel 0.36.2
Now, Install Ansible and check packages again.
pip install ansible
(lltv-1) ki7mt@3950X:~ $ pip list
Package Version
------------ -------------------
ansible 4.3.0
ansible-core 2.11.3
certifi 2021.5.30
cffi 1.14.6
cryptography 3.4.7
Jinja2 3.0.1
MarkupSafe 2.0.1
packaging 21.0
pip 21.1.3
pycparser 2.20
pyparsing 2.4.7
pyspark 3.0.1
PyYAML 5.4.1
resolvelib 0.5.4
setuptools 52.0.0.post20210125
wheel 0.36.2
2 Likes
Buffy
July 31, 2021, 7:17pm
18
Yeah, mine was a fresh venv too, I should have said and saved you a step…
KI7MT
July 31, 2021, 7:19pm
19
Now for the really confusing part.
PyPi Ansible Core links back to Github Ansible. The old package on github ansible-modules-core states that as of version 2.3, the core modules are part of the main Ansible repository under modules.
So, it looks as though the projects combined, and they are maintaining them in a single repo, but, keeping the core modules package versioning separate from the main Ansible package.
1 Like
Buffy
July 31, 2021, 7:21pm
20
Oh that is a confusing for sure; I hope they will sync the versioning going forward.
1 Like