1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/microshift-applying-manifests-example.adoc
2023-12-11 11:27:00 +00:00

90 lines
1.9 KiB
Plaintext

// Module included in the following assemblies:
//
// * microshift/running_applications/microshift-applications.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-applying-manifests-example_{context}"]
= Using manifests example
This example demonstrates automatic deployment of a BusyBox container using `kustomize` manifests in the `/etc/microshift/manifests` directory.
.Procedure
. Create the BusyBox manifest files by running the following commands:
+
.. Define the directory location:
+
[source,terminal]
----
$ MANIFEST_DIR=/etc/microshift/manifests
----
+
.. Make the directory:
+
[source,terminal]
----
$ sudo mkdir -p ${MANIFEST_DIR}
----
+
.. Place the YAML file in the directory:
+
[source,text]
----
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 `kustomize` manifest files by running the following commands:
+
.. Place the YAML file in the directory:
+
[source,text]
----
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-short} to apply the manifests by running the following command:
+
[source,terminal]
----
$ sudo systemctl restart microshift
----
+
. Apply the manifests and start the `busybox` pod by running the following command:
+
[source,terminal]
----
$ oc get pods -n busybox
----