← 返回命令列表

Linux command

oc 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Login to cluster

oc login [https://api.cluster:6443]

Get resources

oc get [pods|services|deployments]

Create from YAML

oc apply -f [manifest.yaml]

Switch project

oc project [project_name]

View logs

oc logs [pod_name]

Execute in pod

oc exec -it [pod_name] -- [command]

说明

oc is the OpenShift CLI. Manages OpenShift/Kubernetes clusters. The tool extends kubectl with OpenShift features. Primary interface for OpenShift.

参数

login _URL_
Authenticate to cluster.
get _RESOURCE_
List resources.
apply -f _FILE_
Apply configuration.
project _NAME_
Switch project/namespace.
logs _POD_
View pod logs.
exec _POD_
Execute in pod.
--help
Display help information.

FAQ

What is the oc command used for?

oc is the OpenShift CLI. Manages OpenShift/Kubernetes clusters. The tool extends kubectl with OpenShift features. Primary interface for OpenShift.

How do I run a basic oc example?

Run `oc login [https://api.cluster:6443]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does login _URL_ do in oc?

Authenticate to cluster.