Introduction We will install a Kubernetes on RHEL 8 with CRI-O, and Podman. We are using an r5.large on Amazon EC2 using Amazon’s provided Red Hat Enterprise Linux 8.
Installation Install the updates on your fresh server from Amazon.
sudo dnf update -y sudo dnf install net-tools -y Setup DNS or atleast Hostname entries in your /etc/hosts file
sudo hostnamectl set-hostname k8.obert.dev sudo init 6 echo `/sbin/ifconfig eth0 | grep 'inet ' | awk {'print $2'}` ${HOSTNAME} | sudo tee -a /etc/hosts Set selinux to permissive
Introduction This will be a quick short blog entry. Today I needed to have a container that could self-initialize it’s own Physical Volumes. This is quite easy to do with an init container. I’m going to provide a simple example to show how this works with busybox.
Deployment YAML initContainers: - name: init-pv image: {{ .Values.initpv.image }} volumeMounts: - name: init mountPath: {{ .Values.persistentVolume.path }} {{- with .Values.initpv.command }} command: {{- toYaml .
Introduction This will be a quick short blog entry. Today I had an image running on Kubernetes from a vender invoked through HELM, and I needed to run some arbtirary commands however I did not want to extend the image and have to deal with maintaining yet another image. Below is the solution I came up with.
YAML to inject commands before entry point. image: repository: docker.io/user/image pullPolicy: IfNotPresent tag: "latest" command: - bash - "-c" - | sed -i 's/^param=.
Changing colors in Terminal I utilize Command Line Interfaces (CLI) frequently, Linux, Unix, Mac etc. Small adjustments to the CLI can make huge impacts on my workflow. Readability of the screen is very important, and I personally prefer a slightly higher contrast display. What I mean by that is on a bright background I prefer dark foreground colors, and on a dark background I prefer bright foreground colors. Unfortuantly the out of the box configuration does not always allow that.
Introduction This will be a quick short blog entry. Today I had an container running Oracle at Amazon EC2 on Kubernetes. I was trying to work thorugh some Pl/SQL code in sqlplus, and decided I wanted to instead use SQL Developer. After a little research this is what I came up with, and wanted to share it.
Bash Script kubectl patch svc oracle -p '{"spec":{"externalIPs":["1.2.3.4"]}}' Basically you pass the kubernetes service name, as well as your ip address of the host (in this example 1.
SSH Keep Alive Secure Shell is a means to connect terminals to servers. When it detects you are idle it disconnects you. This is for security. This however is very annoying and can cause issues if you are installing something and need to keep the terminal active. Some people try to leave ’top’ running or ‘screen’ to keep the terminal busy. There is a simple configuration that can just as easily do this.
Changing colors in BASH So I find some color combations very hard to read. If you have a black background, the dark blue directory color is hard to read. If you have a white background the bright green executable color is hard to read. For whatever reason it was not thought very well through to have well contrasting colors for everything. I found this Ask Ubunutu on how to change the directory colors and decided to write a blog post to make sure I never lost the steps again.
Introduction We will install a Kubernetes on Ubuntu 22.04 with Docker and CRI-Docker. We are using an r5.2xlarge on Amazon EC2 using Amazon’s provided Ubuntu 22.04. You can get by with a much smaller instance depending on what you plan to run.
Installation Update Ubuntu Install the updates on your fresh server from Amazon.
## Update Ubunutu sudo bash sudo apt update -y sudo apt upgrade -y sudo apt autoremove -y # if you see kenerl updates you should reboot # init 6 Hostname Your hostname should be in /etc/hosts.
Introduction GitHub provies “Actions” which are automatic actions that are ran on gitHub for you. This can be used to compile your code, compile your docker image, or do any arbitrary set of commands. This typically is done in software development to automatically push software between development and test. This is typically done to insure all the necessary code, configurations, etc necessary are checked into the source repository. Additionally this insures all the neccessary steps are done uniformly no matter which developer checks in the code.
Introduction With HELM Scripts containers all try to start at the same time. It depends on how the containers scripts were designed on if there is any sort of delay or dependency cchecking built into them. I wrote a very simple busybox script that can be used to prevent a container from starting until the kubernetes services is needs are available.
In this example there are 3 checks going on.
Introduction GitHub provies “Actions” which are automatic actions that are ran on gitHub for you. This can be used to compile your code, compile your docker image, or do any arbitrary set of commands. This typically is done in software development to automatically push software between development and test. This is typically done to insure all the necessary code, configurations, etc necessary are checked into the source repository. Additionally this insures all the neccessary steps are done uniformly no matter which developer checks in the code.
Introduction This cheat sheet from Applo Clark’s Cheatsheet. Amazon’s Official CLI Documentation. Amazon Web Services (AWS)’s Command Line Interface (CLI) is a shell based means to work with AWS. The CLI provides the ability to list out resources at Amazon like which EC2 instances are running, poke around S3 buckets, inspect pretty much anything at Amazon. It also provides advanced features like copying information to and from S3. Below is a cheat sheet I will be updating over time with frequently used commands.
Introduction “Helm is the best way to find, share, and use software built for Kubernetes.” Kubernetes is a great container orchistration tool, however managing all the yaml files associated with it become a huge undertaking. Helm is a tool that allows you to create templates for Kubernetes yaml files. Then you only have to manage a set a value pairs that are passed to your templates. This allows you to easily share packages of templates, and other people can easily bring your containers online only having to modify the values to match their needs to customize or configure.
Introduction This cheat sheet from Alex arak14’s Cheatsheet. Git is a version constrol system often used by developers, and devops to store insource code and configurations. It has even been adapted to store websites that are rended to the internet (like this one!) using Hugo. Git repositories are distributed in that each developers has a local copy of the repository and a series of pushs, pulls, merges, forks occur for the repositories to synchronize with one another.
python http server If you need a quick and easy webserver to copy files between servers, or from your server to your workstation all you need is Python, which is part of YUM and is on almost every redhat based linux server. Simple goto the directory you want to share, and a single command in the shell will start up a webserver that you can use to get your files copied over.
Introduction This is a quick cheat sheet from Sematext’s Docker Cheatsheet
Docker Cheatsheet Tutorial series Get started with Docker: https://docs.docker.com/engine/getstarted/
Installation Linux Install script provided by Docker:
curl -sSL https://get.docker.com/ | sh Or see Installation instructions for your Linux distribution.
Mac OS X Download and install Docker For Mac
Create Docker VM with Docker Machine You can use Docker Machine to:
Install and run Docker on Mac or Windows Provision and manage multiple remote Docker hosts Provision Swarm clusters A simple example to create a local Docker VM with VirtualBox:
Introduction This is a quick cheat sheet from Sematext’s Elastic Devops Cheatsheet
DevOps cheatsheet Allocation Allocation awareness Avoids putting two copies of the same shard on nodes with the same attribute (e.g. rack, availability zone). For example:
node.attr.availability_zone: us-east1 # in elasticsearch.yml Awareness is enabled at the cluster level:
curl -XPUT localhost:9200/_cluster/settings?pretty -d '{ "persistent" : { "cluster.routing.allocation.awareness.attributes" : "availability_zone" } }' Allocation filtering Shards of an index can prefer/avoid nodes with certain attributes.
Introduction This is a quick cheat sheet from Kubernetes Website’s Cheatsheet.
This page contains a list of commonly used kubectl commands and flags.
Kubectl autocomplete BASH source <(kubectl completion bash) # set up autocomplete in bash into the current shell, bash-completion package should be installed first. echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell. You can also use a shorthand alias for kubectl that also works with completion:
Introduction This cheat sheet from Dave Wongillies’s Cheatsheet. OpenSSL is a very strong tool when working with certificates. OpenSSL can be used to for a wide variaty of taks involving SSL/TLS. For instance you can use it to convert certificates from format to another, use it as a debugging tool, use it to generate certificates, use it to download certificates from hosts, and even use it as a connectivity tool if telnet is not available.