Use the manifests example
You can automatically deploy a BusyBox container on MicroShift by using kustomize manifests in the /etc/microshift/manifests directory.
Procedure
-
Create the BusyBox manifest files by running the following commands:
-
Define the directory location:
$ MANIFEST_DIR=/etc/microshift/manifests -
Make the directory:
$ sudo mkdir -p ${MANIFEST_DIR} -
Place the YAML file in the directory:
sudo tee ${MANIFEST_DIR}/busybox.yaml &>/dev/null <<EOF apiVersion: v1 kind: Namespace metadata: name: busybox --- apiVersion: apps/v1 kind: Deployment metadata: name: busybox namespace: busybox-deployment spec: selector: matchLabels: app: busybox template: metadata: labels: app: busybox spec: containers: - name: busybox image: BUSYBOX_IMAGE command: [ "/bin/sh", "-c", "while true ; do date; sleep 3600; done;" ] EOF
-
-
Next, create the
kustomizemanifest files by running the following commands:-
Place the YAML file in the directory:
sudo tee ${MANIFEST_DIR}/kustomization.yaml &>/dev/null <<EOF apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: busybox resources: - busybox.yaml images: - name: BUSYBOX_IMAGE newName: busybox:1.35 EOF
-
-
Restart MicroShift to apply the manifests by running the following command:
$ sudo systemctl restart microshift -
Apply the manifests and start the
busyboxpod by running the following command:$ oc get pods -n busybox