Dev Container Modifications
DevSpace allows you to modify the selected dev container to optimize it for development.
How does it work?
When any modifications are defined for a dev container, DevSpace will do the following:
- Find the Kubernetes pod that contains the dev container according to the selectors defined for this dev container.
- Find the replica owner that this pod was created from (e.g. Deployment, StatefulSet, etc.)
- Scale down the replica number for the replica owner object, i.e. set
replicas: 0
for the Deployment, StatefulSet, etc. - Clone the replica owner object to create a new Deployment/StatefulSet with the name
[old-object-name]-devspace
- Apply the modifications to the newly created Deployment/StatefulSet, e.g. swap out the image, add env vars, etc.
- Wait until the a new pod was created from the new Deployment/StatefulSet
Undo Modifications
To undo the changes that DevSpace made to create the modified version of our dev container, you can run:
devspace reset pods
Config Reference
devImage
required string
DevImage is the image to use for this container and will replace the existing image
if necessary.
devImage
required string command
required string[]
Command can be used to override the entrypoint of the container
command
required string[] args
required string[]
Args can be used to override the args of the container
args
required string[] workingDir
required string
WorkingDir can be used to override the working dir of the container
workingDir
required string env
required object[]
Env can be used to add environment variables to the container. DevSpace will
not replace existing environment variables if an environment variable is defined here.
env
required object[] resources
required
Resources can be used to override the resource definitions of the container
resources
required persistenceOptions
required
PersistenceOptions are additional options for persisting paths within this pod
persistenceOptions
required size
required string
Size is the size of the created persistent volume in Kubernetes size notation like 5Gi
size
required string storageClassName
required string
StorageClassName is the storage type DevSpace should use for this persistent volume
storageClassName
required string accessModes
required string[]
AccessModes are the access modes DevSpace should use for the persistent volume
accessModes
required string[] readOnly
required boolean false
ReadOnly specifies if the volume should be read only
readOnly
required boolean false name
required string
Name is the name of the PVC that should be created. If a PVC with that name
already exists, DevSpace will use that PVC instead of creating one.
name
required string patches
required object[]
Patches are additional changes to the pod spec that should be applied
patches
required object[]