OpenShift 4 之获取全部CRD用户资源定义对象

和OpenShift 3相比,OpenShift 4的一个大变化就是从核心全面支持CRD(用户资源定义)。OpenShift 4所有的配置对象都通过CRD来定义的,这些CRD配置对象全部放在openshift-config项目中。可通过以下方法列出所有环境支持的配置对象:

$ oc get crds  -n openshift-config
NAME                                                        CREATED AT
alertmanagers.monitoring.coreos.com                         2019-11-22T16:18:56Z
apiservers.config.openshift.io                              2019-11-22T15:51:49Z
authentications.config.openshift.io                         2019-11-22T15:51:50Z
authentications.operator.openshift.io                       2019-11-22T15:52:02Z
baremetalhosts.metal3.io                                    2019-11-22T15:54:49Z
builds.config.openshift.io                                  2019-11-22T15:51:50Z
catalogsourceconfigs.operators.coreos.com                   2019-11-22T15:52:00Z
catalogsources.operators.coreos.com                         2019-11-22T15:52:14Z
clusterautoscalers.autoscaling.openshift.io                 2019-11-22T15:52:00Z
clusternetworks.network.openshift.io                        2019-11-22T15:52:37Z
clusteroperators.config.openshift.io                        2019-11-22T15:51:48Z
clusterresourcequotas.quota.openshift.io                    2019-11-22T15:51:49Z
clusterserviceversions.operators.coreos.com                 2019-11-22T15:52:05Z
clusterversions.config.openshift.io                         2019-11-22T15:51:48Z
configs.imageregistry.operator.openshift.io                 2019-11-22T15:51:59Z
configs.samples.operator.openshift.io                       2019-11-22T15:51:59Z
consoleclidownloads.console.openshift.io                    2019-11-22T15:51:59Z
consoleexternalloglinks.console.openshift.io                2019-11-22T15:52:06Z
consolelinks.console.openshift.io                           2019-11-22T15:52:02Z
consolenotifications.console.openshift.io                   2019-11-22T15:52:10Z
consoles.config.openshift.io                                2019-11-22T15:51:50Z
consoles.operator.openshift.io                              2019-11-22T15:52:14Z
containerruntimeconfigs.machineconfiguration.openshift.io   2019-11-22T15:54:02Z
controllerconfigs.machineconfiguration.openshift.io         2019-11-22T15:53:57Z
credentialsrequests.cloudcredential.openshift.io            2019-11-22T15:52:01Z
dnses.config.openshift.io                                   2019-11-22T15:51:50Z
dnses.operator.openshift.io                                 2019-11-22T15:52:01Z
dnsrecords.ingress.operator.openshift.io                    2019-11-22T15:52:01Z
egressnetworkpolicies.network.openshift.io                  2019-11-22T15:52:38Z
featuregates.config.openshift.io                            2019-11-22T15:51:50Z
hostsubnets.network.openshift.io                            2019-11-22T15:52:37Z
imagecontentsourcepolicies.operator.openshift.io            2019-11-22T15:51:51Z
images.config.openshift.io                                  2019-11-22T15:51:51Z
infrastructures.config.openshift.io                         2019-11-22T15:51:51Z
ingresscontrollers.operator.openshift.io                    2019-11-22T15:52:05Z
ingresses.config.openshift.io                               2019-11-22T15:51:51Z
installplans.operators.coreos.com                           2019-11-22T15:52:09Z
kubeapiservers.operator.openshift.io                        2019-11-22T15:51:59Z
kubecontrollermanagers.operator.openshift.io                2019-11-22T15:51:59Z
kubeletconfigs.machineconfiguration.openshift.io            2019-11-22T15:54:00Z
kubeschedulers.operator.openshift.io                        2019-11-22T15:52:00Z
machineautoscalers.autoscaling.openshift.io                 2019-11-22T15:52:03Z
machineconfigpools.machineconfiguration.openshift.io        2019-11-22T15:53:58Z
machineconfigs.machineconfiguration.openshift.io            2019-11-22T15:53:56Z
machinedisruptionbudgets.healthchecking.openshift.io        2019-11-22T15:52:57Z
machinehealthchecks.healthchecking.openshift.io             2019-11-22T15:52:53Z
machines.machine.openshift.io                               2019-11-22T15:52:49Z
machinesets.machine.openshift.io                            2019-11-22T15:52:53Z
mcoconfigs.machineconfiguration.openshift.io                2019-11-22T15:52:04Z
netnamespaces.network.openshift.io                          2019-11-22T15:52:38Z
network-attachment-definitions.k8s.cni.cncf.io              2019-11-22T15:52:33Z
networks.config.openshift.io                                2019-11-22T15:51:51Z
networks.operator.openshift.io                              2019-11-22T15:51:53Z
oauths.config.openshift.io                                  2019-11-22T15:51:52Z
openshiftapiservers.operator.openshift.io                   2019-11-22T15:52:00Z
openshiftcontrollermanagers.operator.openshift.io           2019-11-22T15:52:02Z
operatorgroups.operators.coreos.com                         2019-11-22T15:52:16Z
operatorhubs.config.openshift.io                            2019-11-22T15:51:49Z
operatorsources.operators.coreos.com                        2019-11-22T15:52:03Z
podmonitors.monitoring.coreos.com                           2019-11-22T16:18:58Z
projects.config.openshift.io                                2019-11-22T15:51:52Z
prometheuses.monitoring.coreos.com                          2019-11-22T16:18:57Z
prometheusrules.monitoring.coreos.com                       2019-11-22T16:18:58Z
proxies.config.openshift.io                                 2019-11-22T15:51:49Z
rolebindingrestrictions.authorization.openshift.io          2019-11-22T15:51:48Z
schedulers.config.openshift.io                              2019-11-22T15:51:52Z
securitycontextconstraints.security.openshift.io            2019-11-22T15:51:49Z
servicecas.operator.openshift.io                            2019-11-22T15:52:02Z
servicecatalogapiservers.operator.openshift.io              2019-11-22T15:52:01Z
servicecatalogcontrollermanagers.operator.openshift.io      2019-11-22T15:52:01Z
servicemonitors.monitoring.coreos.com                       2019-11-22T16:18:57Z
subscriptions.operators.coreos.com                          2019-11-22T15:52:13Z
tuneds.tuned.openshift.io                                   2019-11-22T15:52:00Z

还可查看某个CRD配置对象的情况:

NAME      AGE
cluster   22d
$ oc get networks.config.openshift.io cluster -o yaml
apiVersion: config.openshift.io/v1
kind: Network
metadata:
  creationTimestamp: "2019-11-22T15:51:55Z"
  generation: 2
  name: cluster
  resourceVersion: "1532"
  selfLink: /apis/config.openshift.io/v1/networks/cluster
  uid: 023da834-0d40-11ea-912d-525400ae0293
spec:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  externalIP:
    policy: {}
  networkType: OpenShiftSDN
  serviceNetwork:
  - 172.30.0.0/16
status:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  clusterNetworkMTU: 1450
  networkType: OpenShiftSDN
  serviceNetwork:
  - 172.30.0.0/16

多数情况下可以使用短名称访问CRD对象,例如clusterversions.config.openshift.io等同于clusterversions:

$ oc get clusterversions
NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.2.8     True        False         22d     Cluster version is 4.2.8

$ oc get clusterversions.config.openshift.io                         
NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.2.8     True        False         22d     Cluster version is 4.2.8
$ oc get networks.config.openshift.io
发布了54 篇原创文章 · 获赞 0 · 访问量 1156

猜你喜欢

转载自blog.csdn.net/weixin_43902588/article/details/103545886
今日推荐