4.2. 常见操作
开发人员 CLI 允许与 OpenShift Container Platform 管理的各种对象交互。许多常见 oc 操作都使用以下语法调用:
oc <action> <object_type> <object_name>
$ oc <action> <object_type> <object_name>
这将指定:
-
要执行的
<action>,如get或describe。 -
要执行
操作的 <object_type>,如service或缩写svc。 -
指定 &
lt;object_;。type> 的 <object_name>
例如,oc get 操作返回当前定义的服务的完整列表:
oc get svc
$ oc get svc
输出示例
NAME LABELS SELECTOR IP PORT(S) docker-registry docker-registry=default docker-registry=default 172.30.78.158 5000/TCP kubernetes component=apiserver,provider=kubernetes <none> 172.30.0.2 443/TCP kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.0.1 80/TCP
NAME LABELS SELECTOR IP PORT(S)
docker-registry docker-registry=default docker-registry=default 172.30.78.158 5000/TCP
kubernetes component=apiserver,provider=kubernetes <none> 172.30.0.2 443/TCP
kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.0.1 80/TCP
然后,oc describe 操作可用于返回有关特定对象的详细信息:
oc describe svc docker-registry
$ oc describe svc docker-registry
输出示例