> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/deployment/ja/self-hosted/enterprise/kubernetes.md).

# Kubernetes

Kubernetes で Roboflow Inference を始める

{% hint style="info" %}
Roboflow Enterprise のお客様は、次の [Roboflow Inference Helm chart](https://github.com/roboflow/inference/tree/main/inference/enterprise/helm-chart).
{% endhint %}

を使用して、Kubernetes で Roboflow Inference Service をデプロイできます。あるいは、Kubernetes クラスターに Pod と Service をデプロイするためのシンプルなマニフェストを以下に示します。

以下の Kubernetes マニフェストは、CPU ベースの roboflow infer Pod を 1 つ作成し、ClusterIP Service を関連付ける簡単な例です。

```yaml
# Pod
---
apiVersion: v1
kind: Pod
metadata:
  name: roboflow
  labels:
    app.kubernetes.io/name: roboflow
spec:
  containers:
  - name: roboflow
    image: roboflow/roboflow-inference-server-cpu
    ports:
    - containerPort: 9001
      name: rf-pod-port


# Service
---
apiVersion: v1
kind: Service
metadata:
  name: rf-service
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: roboflow
  ports:
  - name: rf-svc-port
    protocol: TCP
    port: 9001
    targetPort: rf-pod-port
```

（上記の例では、Kubernetes クラスターが Docker Hub からイメージをダウンロードできることを前提としています）

上記の YAML の記述を `roboflow.yaml` として保存し、 `kubectl` CLI を使って、Kubernetes クラスターの default 名前空間に Pod と Service をデプロイします。

```
kubectl apply -f roboflow.yaml
```

\
（ClusterIP 型の）Service が作成されます。Kubernetes クラスター内から、次の URI で Roboflow Inference にアクセスできます。 `http://rf-service.default.svc:9001`

### この例を応用する

Kubernetes を使うと、Roboflow Inference Service にさまざまな高度な機能や拡張機能を組み込めます。たとえば、上記の例を拡張して、次のような高度な用途に対応できます。

* nodeSelector を使用して、Kubernetes 環境内の GPU ノードプールで Pod を実行し、 `roboflow/roboflow-inference-server-gpu` イメージを使用する
* Kubernetes Deployment を作成して Roboflow Inference Service を水平スケーリングし、CPU 使用率などの特定のメトリクスに基づいて自動スケーリングのトリガーを設定する
* NodePort や LoadBalancer など、異なる種類の Service を使用して Roboflow Inference Service を外部に公開する
* Ingress コントローラーを使用して Roboflow Inference を TLS（HTTPS）経由で公開する、など
* Roboflow Inference Service に監視とアラートを追加する
* 統合する [Secure Gateway](/deployment/ja/self-hosted/enterprise/secure-gateway.md) および [Offline Mode](/deployment/ja/self-hosted/enterprise/offline-mode.md)
