How to create a dev container with odo
and Devfile on a local Kubernetes cluster
Devfile promises portable dev environments.
- Start a local Kubernetes cluster E.g. the integrated Kubernetes cluster of Rancher Desktop.
- Install the
odo
CLI E.g. on macOS with Brew, run
brew update && brew install odo-dev
- Create a Devfile
mkdir -p /tmp/devfile
cd /tmp/devfile
cat <<EOF > .devfile.yaml
schemaVersion: 2.1.0
components:
- name: thedevcontainer
container:
image: ubuntu:22.04
command: ['sleep', 'infinity']
mountSources: true
EOF 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.