Devfile is standard for declaring containerized development environments. We may use Devfiles in combination with odo
to set up and tear down dev environments on Kubernetes.
To create a dev environment on a local Kubernetes cluster with Devfile and odo
, only three steps are necessary:
- Start the local Kubernetes cluster E.g. the integrated Kubernetes cluster of Rancher Desktop.
- Install the
odo
CLI E.g. on macOS with Brew, runbrew 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 the local Kubernetes cluster and we may exec into it and run commands.