Configure Your Workstation

This tutorial assumes that you are running a Unix like operating system on your workstation. i.e. Mac OS, Fedora, or other Linux distribution. If you are running Windows, you might try the Windows Subsystem For Linux.

  1. Select a domain to use for your lab. This can be a fake domain, it is just for your internal lab network.

    For example: my.awesome.lab

  2. Select a network for your edge router. We’ll determine everything else from that address, and we’ll be using a /24 network, i.e.

    For example:

    Note: Do not use the network of your home router, generally or something similar. The important thing is to choose a different network. Use a network from the internal IP ranges of: 192.168.*.0 or 10.*.*.0.

  3. Set a few seed variables for your lab:

    export LAB_DOMAIN="my.awesome.lab"
    export EDGE_NETWORK=""
    export OKD_LAB_PATH=${HOME}/okd-lab
  4. Create your lab configuration YAML file:

    I’m being intentionally prescriptive here to help ensure success the first time you try this.

    mkdir -p ${OKD_LAB_PATH}/lab-config
    IFS="." read -r i1 i2 i3 i4 <<< "${EDGE_NETWORK}"
    DEV_EDGE_IP=$(echo "${i1}.${i2}.${i3}.2")
    DEV_ROUTER=${i1}.${i2}.$(( ${i3} + 1 )).1
    DEV_INGRESS=${i1}.${i2}.$(( ${i3} + 1 )).2
    DEV_NETWORK=${i1}.${i2}.$(( ${i3} + 1 )).0
    cat << EOF > ${OKD_LAB_PATH}/lab-config/lab.yaml
    domain: ${LAB_DOMAIN}
    network: ${EDGE_NETWORK}
    router-ip: ${EDGE_ROUTER}
    bastion-ip: ${BASTION_HOST}
    centos-mirror: rsync://
    gitea-version: 1.16.7
    openwrt-version: 21.02.1
    git-url: https://gitea.${LAB_DOMAIN}:3000
    - name: dev
      router-edge-ip: ${DEV_EDGE_IP}
      router-ip: ${DEV_ROUTER}
      network: ${DEV_NETWORK}
      cluster-config-file: ${OKD_LAB_PATH}/lab-config/dev-cluster.yaml

    Your lab configuration YAML file should look something like this:

    domain: my.awesome.lab
    - name: dev
      cluster-config-file: /home/username/okd-lab/lab-config/dev-cluster.yaml
  5. Now create the header for your cluster configuration file:

    cat << EOF  > ${OKD_LAB_PATH}/lab-config/dev-cluster.yaml
      name: dev
      secret-file: ${OKD_LAB_PATH}/lab-config/pull_secret.json
      local-registry: nexus.${LAB_DOMAIN}:5001
      proxy-registry: nexus.${LAB_DOMAIN}:5000
      butane-version: v0.14.0
      butane-spec-version: 1.4.0
      ingress-ip-addr: ${DEV_INGRESS}
      release: 4.10.0-0.okd-2022-05-07-021833

    We’ll fill in the rest of this file later, based on your lab setup, KVM vs. Bare Metal.

  6. Create a folder for the scripts that we’ll be using:

    mkdir ${OKD_LAB_PATH}/bin
  7. Install yq we will need it for YAML file manipulation:

    • MacOS:

      brew install yq
    • Linux:

      mkdir ${OKD_LAB_PATH}/yq-tmp
      YQ_VER=$(curl | cut -d"/" -f8 | cut -d\" -f1)
      wget -O ${OKD_LAB_PATH}/yq-tmp/yq.tar.gz${YQ_VER}/yq_linux_amd64.tar.gz
      tar -xzf ${OKD_LAB_PATH}/yq-tmp/yq.tar.gz -C ${OKD_LAB_PATH}/yq-tmp
      cp ${OKD_LAB_PATH}/yq-tmp/yq_linux_amd64 ${OKD_LAB_PATH}/bin/yq
      chmod 700 ${OKD_LAB_PATH}/bin/yq

Install the labcli utilities for the Lab

I have created a companion project for this blog. It contains all of the shell functions that I use to ease the task of building and tearing down infrastructure in my lab.

In the spirit of Kubernetes naming, I wanted to give it a nautical name. Since these scripts take on the drudgery of repeated tasks, I chose to name them after the guy that cleans the toilets on a ship… Thus, the project is named: καμαρότος. That is, kamarótos; Greek for Ship’s steward or cabin boy…

  1. Clone the git repository that I have created with helper scripts:

    git clone ${OKD_LAB_PATH}/kamarotos
  2. Copy the helper scripts to your ${OKD_LAB_PATH} directory:

    cp ${OKD_LAB_PATH}/kamarotos/bin/* ${OKD_LAB_PATH}/bin
    chmod 700 ${OKD_LAB_PATH}/bin/*
  3. Add the following to your shell environment:

    Your default shell will be something like bash or zsh. Although you might have changed it.

    You need to add the following line to the appropriate shell file in your home directory: .bashrc, or .zshrc, etc…


    echo ". ${OKD_LAB_PATH}/bin/" >> ~/.bashrc


    echo ". ${OKD_LAB_PATH}/bin/" >> ~/.zshrc
  4. Log off and back on to set the variables.

  5. If you don’t have an SSH key pair configured on your workstation, then create one now:

    ssh-keygen -t rsa -b 4096 -N "" -f ${HOME}/.ssh/id_rsa
  6. Copy the SSH public key to the Lab configuration folder:

    cp ~/.ssh/ ${OKD_LAB_PATH}/
  7. Now, you are ready to set up your lab network:

    Set Up Lab Network