이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 2. How Operators work with Red Hat build of MicroShift


You can use Operators with Red Hat build of MicroShift to create applications that monitor the running services in your cluster. Operators can manage applications and their resources, such as deploying a database or message bus. As customized software running inside your cluster, Operators can be used to implement and automate common operations.

Operators offer a more localized configuration experience and integrate with Kubernetes APIs and CLI tools such as kubectl and oc. Operators are designed specifically for your applications. Operators enable you to configure components instead of modifying a global configuration file.

Red Hat build of MicroShift applications are generally expected to be deployed in static environments. However, Operators are available if helpful in your use case. To determine an Operator’s compatibility with Red Hat build of MicroShift, check the Operator’s documentation.

2.1. How to install Operators in Red Hat build of MicroShift

To minimize the footprint of Red Hat build of MicroShift, Operators are installed directly with manifests instead of using the Operator Lifecycle Manager (OLM). The following examples provide instructions on how you can use the kustomize configuration management tool with Red Hat build of MicroShift to deploy an application. Use the same steps to install Operators with manifests.

2.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.

2.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

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.