-
-
Save wgordon17/1c95af1885d4fdcfea4f836c45b5eb39 to your computer and use it in GitHub Desktop.
kind: DeploymentConfig | |
apiVersion: v1 | |
metadata: | |
name: minimal-dc | |
spec: | |
replicas: 1 | |
selector: | |
name: busybox | |
template: | |
metadata: | |
labels: | |
name: busybox | |
spec: | |
containers: | |
- name: busybox | |
image: busybox | |
args: | |
- /bin/sh | |
- -c | |
- > | |
while true; do | |
sleep 10; | |
done |
The while loop is included to ensure the pod is always doing something. If it's not running a long running command, the pod exits, and then Kubernetes keeps trying to bring it back up causing loops
This just runs a generic busybox image hosted on Dockerhub (https://hub.docker.com/_/busybox/)
While replicas: 1
isn't required, the deployment won't auto-create any pods without specifying the replicas
. You can certainly just leave this off and manually scale up later.
containers
is an array of the containers to be contained within the pod. It's certainly possible to provide more than 1 element in the array to have multiple containers in the pod, however it's typically more common to see just 1
By default, the image
within the containers
array will use Dockerhub as the image repository to lookup. If you want to reference an image within your local cluster, you can either use the oc set image-lookup
command (use oc set image-lookup -h
for more details) to force local lookups for the specified image, or you can rely on ImageChange triggers and leave the image
field off entirely.
The
selector
needs to match at least 1 of the labels underspec
>template
>metadata