---
schema_version: "1"
id: 756f51af7a4464647e9b1eac89e57d5a8b7b7a8b7afad16c053e389681da555a
title: Mule アプリケーション Kubernetes リソースのカスタマイズ
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/runtime-fabric/2.5/customize-kubernetes-crd.md
canonical_url: https://docs.mulesoft.com/jp/runtime-fabric/2.5/customize-kubernetes-crd
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 9f1283e3d050cf240434e40cac85d0b0c8a106ffbdc5ded84d5670b21284c5b9
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# Mule アプリケーション Kubernetes リソースのカスタマイズ

Anypoint Runtime Fabric では、カスタムリソース ​`kubernetestemplates.rtf.mulesoft.com`​ テンプレートを使用して Mule アプリケーション Kubernetes リソースをカスタマイズできます。

`kubernetestemplate`​ リソースに ​`mule-application`​ という名前を付けます。テンプレートは 2 つの異なる名前空間で定義できます。

- アプリケーション名前空間  
    テンプレートは、指定された名前空間にデプロイされたすべての Mule アプリケーションに適用されます。
- Runtime Fabric エージェント名前空間  
    テンプレートは、指定された Runtime Fabric エージェントによって管理されるすべての Mule アプリケーションに適用されます。

`kubernetestemplate`​ リソースは、リソースが作成された後に作成される Mule アプリケーションデプロイメントにのみ適用されます。既存のデプロイメントには影響しません。​`kubernetestemplate`​ を作成または更新した後に Mule アプリケーションを再デプロイすると、テンプレートが適用されます。

`kubernetestemplate`​ リソースを使用すると、アプリケーションのポッド、デプロイメント、およびサービスオブジェクトで次の要素を設定できます。

- ポッド
    
    - [アノテーション](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
    - [表示ラベル](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)
    - [ノードセレクター](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/)
    - [アフィニティ](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/)
    - [セキュリティコンテキスト](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
    - [揮発ストレージ制限](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#local-ephemeral-storage)
    - [許容範囲](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
    - [トポロジー拡散制約](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/)

セキュリティコンテキストポッドの場合、使用するキーは ​`containerSecurityContext`​ です。

- デプロイメント
    
    - アノテーション
    - Labels (ラベル)
- サービス
    
    - アノテーション
    - Labels (ラベル)

Runtime Fabric ですでに定義されている設定要素は、テンプレートで定義した設定要素より優先されます。

テンプレートに設定できるキー要素の CRD を取得するには、次のコマンドを実行することで Kubernetes の仕様を取得します。

```copy
kubectl get crd kubernetestemplates.rtf.mulesoft.com -o yaml
```

## [](#例)例

`ポッド`​、​`デプロイ`​、​`サービス`​オブジェクトでの​`表示ラベル`​の設定

```copy
apiVersion: rtf.mulesoft.com/v1
kind: KubernetesTemplate
metadata:
  name: mule-application
  namespace: rtf
spec:
  deployment:
    metadata:
      labels:
        deploymentLabel: value
  service:
    metadata:
      labels:
        serviceLabel: value
  pod:
    metadata:
      labels:
        podLabel: value
```

`ポッド`​オブジェクトの下にある ​`containerSecurityContext`​ のランタイムデフォルト ​`seccompProfile`​ の設定:

```copy
apiVersion: rtf.mulesoft.com/v1
kind: KubernetesTemplate
metadata:
  name: mule-application
  namespace: rtf
spec:
  pod:
    containerSecurityContext:
      seccompProfile:
        type: RuntimeDefault
```

設定できるすべてのキーを示した別の例:

```copy
apiVersion: "rtf.mulesoft.com/v1"
kind: KubernetesTemplate
metadata:
  name: mule-application
  namespace: rtf
  labels:
spec:
  deployment:
    metadata:
      labels:
      annotations:
  service:
    metadata:
      labels:
      annotations:
  pod:
    metadata:
      labels:
      annotations:
    containerSecurityContext:
      seccompProfile:
        type: RuntimeDefault
    tolerations:
    - key: "example-key"
      operator: "Exists"
      effect: "NoSchedule"
    ephemeralStorageLimit: 4gb
    nodeSelector:
      region: us-east
    affinity:
    topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: topology.kubernetes.io/zone
      whenUnsatisfiable: DoNotSchedule
      labelSelector:
        matchLabels:
          rtf.mulesoft.com/id: {{ .Values.id }}
```

CRD を使用して上書きできないキー要素:

- デプロイメント
    
    - labels (表示ラベル)
        
        - 環境
        - 組織
        - type
        - rtf.mulesoft.com/id
        - rtf.mulesoft.com/version
        - rtf.mulesoft.com/agentNamespace
- アノテーション
    
    - rtfc.mulesoft.com/egress-ruleset (if set in deployment values)
    - rtf.mulesoft.com/desiredStatus
    - rtf.mulesoft.com/replicas
    - rtf.mulesoft.com/version
- ポッド
    
    - アノテーション
        
        - fluentbit.io/exclude
        - mulesoft.com/resources
    - labels (表示ラベル)
        
        - app
        - 環境
        - am-org-id
        - root-org-id
        - 組織
        - rtf.mulesoft.com/id
        - rtf.mulesoft.com/generation
        - type
        - rtf.mulesoft.com/disableAmLogForwarding
        - name
- リソース
    
    - ephemeral-storage (env.resources で設定されていないか、またはクラスターフレーバーが rtfc である場合)
- SecurityContext
    
    - runAsUser
    - runAsGroup
    - allowPrivilageEscalation
    - capabilities
    - privileged
    - readOnlyRootFilesystem
- NodeSelector
    
    - kubernetes.io/os
    - kubernetes.io/arch
    - beta.kubernetes.io/os
    - beta.kubernetes.io/arch
    - RTF.DeploymentNodeSelector
- Affinity (アフィニティ)
    
    - podAntiAffinity
- サービス
    
    - labels (表示ラベル)
        
        - ingress.rtf.mulesoft.com/bind
        - rtf.mulesoft.com/id
        - rtf.mulesoft.com/version
        - rtf.mulesoft.com/agentNamespace
    - アノテーション
        
        - rtf.mulesoft.com/merge-policy
        - rtf.mulesoft.com/environment
        - rtf.mulesoft.com/organization