Search

Chapter 1. Application deployment with Red Hat build of MicroShift

download PDF

You can use the kustomize configuration management tool to deploy applications. Read through the following procedure for an example of how this tool works in Red Hat build of MicroShift.

1.1. How manifests work with kustomize

The kustomize configuration management tool is integrated with Red Hat build of MicroShift. At every start, Red Hat build of MicroShift searches the /etc/microshift/manifests and /usr/lib/microshift/ manifest directories for a kustomization.yaml file. If it finds one, Red Hat build of MicroShift automatically runs the equivalent of the kubectl apply -k command to apply the identified manifests to the cluster.

LocationIntent

/etc/microshift/manifests

Read-write location for configuration management systems or development.

/usr/lib/microshift/manifests

Read-only location for embedding configuration manifests on OSTree-based systems.

1.2. Using manifests example

This example demonstrates automatic deployment of a BusyBox container using kustomize manifests in the /etc/microshift/manifests directory.

Procedure

  1. Create the BusyBox manifest files by running the following commands:

    1. Define the directory location:

      $ MANIFEST_DIR=/etc/microshift/manifests
    2. Make the directory:

      $ sudo mkdir -p ${MANIFEST_DIR}
    3. 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-deployment
      spec:
        selector:
          matchLabels:
            app: busybox
        template:
          metadata:
            labels:
              app: busybox
          spec:
            containers:
            - name: busybox
              image: BUSYBOX_IMAGE
              command:
                - sleep
                - "3600"
      EOF
  2. Next, create the kustomize manifest files by running the following commands:

    1. 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: registry.k8s.io/busybox
      EOF
  3. Restart Red Hat build of MicroShift to apply the manifests by running the following command:

    $ sudo systemctl restart microshift
  4. Apply the manifests and start the busybox pod by running the following command:

    $ oc get pods -n busybox
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.