hakk

software development, devops, and other drivel
Tree lined path

Blog

Using a Kubernetes Configmap in a Pod

A ConfigMap is provided as a way to inject configuration data into a pod/pods. It can be included as files or be used as environment variables. Below are a couple of examples of mounting a configmap using both methods. Use as File In this first example I’ll show how to create a configmap and mount it using the key(s) as filenames and the data as the file content. It will then be used in an Nginx container as the index page. Read more...

CentOS 9 Automated KVM Install Using Kickstart

A quick demo using virt-install and Kickstart to provision a new CentOS 9 virtual machine. This uses KVM (Kernel Virtual Machine) and libvirt to manage the VM. And uses Kickstart to setup and install the new system within the virtual machine. Creating kickstart file I’m going to post my Kickstart file on GitHub as a reference. It installs a headless server with some system admin tools, sets up networking, SELinux, and uses autopart to partition the disk with LVM support. Read more...

Ansible - Please add this host's fingerprint to your known_hosts file to manage this host

If you’ve ever tried to run an ansible playbook and recieved Please add this host's fingerprint to your known_hosts file to manage this host you’re not alone. Here’s a couple of ways to fix it. Turn off host key checking This would not be the preferred method but turning off host key checking will enable ansible to continue on with the playbook. Either modify the /etc/ansible/ansible.cfg or create an ansible.cfg file in the project directory and add the following lines to it: Read more...

Install and Configure Embedded Python on Windows

I wanted to document these steps after downloading embedded Python recently. I extracted it, set the environment path and started the interpreter. Everything seemed to be going smoothly until I tried to exit exit() and it reported back ’exit not found’ or something like that. What!? How can this be? I ended up import sys and using sys.exit() but this sent me on an adventure to determine how to use embedded Python as a regular install. Read more...

Convert Images to WebP using the Linux command line and Docker

The webp command line tool from Google makes it quite simple to convert images to the webp format from the command line. It can convert JPG, PNG, and TIFF images to WebP. Not sure what webp is? Read more about webp on Wikipedia. If you don’t have Docker installed on your system already, go ahead and install it now. Spin up a Debian Bookworm docker container and mount the directory with your images to the container. Read more...

Install OpenWRT x86 64 Using an A/B Partition Setup

A quick reference for OpenWRT Installation Prepare Debian bootable USB Connect your Debian USB and boot Download OpenWRT image onto the Debian USB Flash the SSD drive with the OpenWRT image Resize the OpenWRT partition Create an additional partition Upgrade Prepare a bootable Debian USB You can use another distro if you’d like. I use Debian as a personal perference and also because it’s relatively quick to create a live USB. Read more...

Connecting from Mac OSX to Ubuntu Desktop

After discovering how pleasant it can be without the sound of a whirring fan, I started looking for options to move my desktop as far away as possible so I no longer had to listen to all the fan noise. The MicroSoft RDP App works great on Mac and allows me to connect to not only Windows but to Linux desktop environments. After installing this on my mac I was able to remote into my Windows desktop (Follow this guide). Read more...

Detect When the Browser URL Changes (JavaScript)

When building a single page web app it’s important to update the URLs without refreshing the page and so the user can easily copy and share or revisit the current page. How Can This Be Done? Fortunately the browser provides an API that works in such use cases. Enter “popstate event” this works hand and hand with the history.pushState() event which updates the URL. When the user clicks either the forward or back button the URL will change but unfortunately the page content will not. Read more...

Update Browser URL Without Page Reload (JavaScript)

When building a single page web app it’s important to update the URLs without refreshing or reloading the page. This will also enable the user to easily copy and share or revisit the current page. Using the History API Browsers provide a History API that allows the page URL to be updated that works great for this use case. The API does allow for sharing other data but has limitations; with that in mind it would be better to find another way to share any data especially if it’s sizable. Read more...

Deploy WordPress on KataCoda Kubernetes

A step by step guide to deploying WordPress on Kubernetes provided by the KataCoda website. Please note that this shouldn’t be used for a production deployment and should only be used for learning and/or practice. Create a Secret for the MySQL Password The first step is to create a secret that can be used to store the MySQL database password. Later in the deployment this will be used in creating the MySQL database pod and then used by the WordPress pod to connect to the database. Read more...