Today I Learned (April 22, 2024)

How to create a dev container with odo and Devfile on a local Kubernetes cluster

Devfile promises portable dev environments.

  1. Start a local Kubernetes cluster E.g. the integrated Kubernetes cluster of Rancher Desktop.
  2. Install the odo CLI E.g. on macOS with Brew, run
brew update && brew install odo-dev
  1. Create a Devfile
mkdir -p /tmp/devfile
cd /tmp/devfile
cat <<EOF > .devfile.yaml
schemaVersion: 2.1.0
- name: thedevcontainer
  image: ubuntu:22.04
  command: ['sleep', 'infinity']
  mountSources: true
odo dev

The above should start a pod running Ubuntu 22.04 in your local Kubernetes cluster that you should be able to exec into and run commands.