NAME 名称

podman-kube-apply - Apply Kubernetes YAML based on containers, pods, or volumes to a Kubernetes cluster
podman-kube-apply - 根据容器、Pod 或卷应用基于 YAML 的 Kubernetes 到 Kubernetes 集群

SYNOPSIS 概要

podman kube apply [options] [container… | pod… | volume…]
podman kube apply [选项] [容器... | Pod... | 卷...]

DESCRIPTION 描述

podman kube apply deploys a podman container, pod, or volume to a Kubernetes cluster. Use the --file option to deploy a Kubernetes YAML (v1 specification) to a Kubernetes cluster as well.
podman kube apply 部署一个 podman 容器、Pod 或卷到 Kubernetes 集群。也可以使用 --file 选项将 Kubernetes YAML(v1 规范)部署到 Kubernetes 集群。

Note that the Kubernetes YAML file can be used to run the deployment in Podman via podman-play-kube(1).
请注意,Kubernetes YAML 文件可用于通过 podman-play-kube(1) 在 Podman 中运行部署。

OPTIONS 选项

--ca-cert-file=ca cert file path | “insecure”
--ca-cert-file=ca 证书文件路径 | “不安全” ¶

The path to the CA cert file for the Kubernetes cluster. Usually the kubeconfig has the CA cert file data and generate kube automatically picks that up if it is available in the kubeconfig. If no CA cert file data is available, set this to insecure to bypass the certificate verification.
Kubernetes 集群的 CA 证书文件路径。通常 kubeconfig 包含 CA 证书文件数据,如果 kubeconfig 中有可用数据, generate kube 会自动选择它。如果没有可用的 CA 证书文件数据,请将其设置为 insecure 以绕过证书验证。

--file, -f=kube yaml filepath
--file,-f=kube yaml 文件路径

Path to the kubernetes yaml file to deploy onto the kubernetes cluster. This file can be generated using the podman kube generate command. The input may be in the form of a yaml file, or stdin. For stdin, use --file=-.
要部署到 Kubernetes 集群的 Kubernetes yaml 文件的路径。可以使用 podman kube generate 命令生成此文件。输入可以是 yaml 文件形式,也可以是标准输入。对于标准输入,请使用 --file=-

--kubeconfig, -k=kubeconfig filepath
--kubeconfig,-k=kubeconfig 文件路径

Path to the kubeconfig file to be used when deploying the generated kube yaml to the Kubernetes cluster. The environment variable KUBECONFIG can be used to set the path for the kubeconfig file as well. Note: A kubeconfig can have multiple cluster configurations, but kube generate always picks the first cluster configuration in the given kubeconfig.
部署生成的 kube yaml 到 Kubernetes 集群时要使用的 kubeconfig 文件路径。环境变量 KUBECONFIG 也可以用于设置 kubeconfig 文件的路径。注意:一个 kubeconfig 可以有多个集群配置,但是 kube generate 总是选择给定 kubeconfig 中的第一个集群配置。

--ns=namespace --ns=命名空间 ¶

The namespace or project to deploy the workloads of the generated kube yaml to in the Kubernetes cluster.
部署生成的 kube yaml 的工作负载到 Kubernetes 集群中的命名空间或项目。

--service, -s

Used to create a service for the corresponding container or pod being deployed to the cluster. In particular, if the container or pod has portmap bindings, the service specification includes a NodePort declaration to expose the service. A random port is assigned by Podman in the service specification that is deployed to the cluster.
用于为部署到集群中的相应容器或 pod 创建服务。特别是,如果容器或 pod 具有端口映射绑定,服务规范将包括一个 NodePort 声明来公开服务。Podman 在部署到集群中的服务规范中分配一个随机端口。

EXAMPLES 示例

Apply a podman volume and container to the “default” namespace in a Kubernetes cluster.
在 Kubernetes 集群中将一个 podman 卷和容器应用于“default”命名空间。

$ podman kube apply --kubeconfig /tmp/kubeconfig myvol vol-test-1
Deploying to cluster...
Successfully deployed workloads to cluster!
$ kubectl get pods
NAME             READY   STATUS    RESTARTS   AGE
vol-test-1-pod   1/1     Running   0          9m

Apply a Kubernetes YAML file to the “default” namespace in a Kubernetes cluster.
将 Kubernetes YAML 文件应用到 Kubernetes 集群中的“default”命名空间。

$ podman kube apply --kubeconfig /tmp/kubeconfig -f vol.yaml
Deploying to cluster...
Successfully deployed workloads to cluster!
$ kubectl get pods
NAME             READY   STATUS    RESTARTS   AGE
vol-test-2-pod   1/1     Running   0          9m

Apply a Kubernetes YAML file to the “test1” namespace in a Kubernetes cluster.
将 Kubernetes YAML 文件应用到 Kubernetes 集群中的“test1”命名空间。

$ podman kube apply --kubeconfig /tmp/kubeconfig --ns test1 vol-test-3
Deploying to cluster...
Successfully deployed workloads to cluster!
$ kubectl get pods --namespace test1
NAME             READY   STATUS    RESTARTS   AGE
vol-test-3-pod   1/1     Running   0          9m

SEE ALSO 参见 ¶

podman(1), podman-container(1), podman-pod(1), podman-kube-play(1), podman-kube-generate(1)

HISTORY 历史 ¶

September 2022, Originally compiled by Urvashi Mohnani (umohnani at redhat dot com)
2022 年 9 月,最初由 Urvashi Mohnani(umohnani at redhat dot com)编写