第 12 章 ClusterClaims
ClusterClaim 是受管集群中的一个集群范围的自定义资源定义(CRD)。ClusterClaim 代表受管集群声明的一个信息片段。以下示例显示了 YAML 文件中标识的声明:
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: ClusterClaim
metadata:
name: id.openshift.io
spec:
value: 95f91f25-d7a2-4fc3-9237-2ef633d8451c
下表显示了 Red Hat Advanced Cluster Management for Kubernetes 管理的集群中可能会定义的 ClusterClaims:
| 声明名称 | 保留 | 可变 | 描述 |
|---|---|---|---|
|
| true | false | 在上游社区定义的 ClusterID |
|
| true | true | Kubernetes 版本 |
|
| true | false | 运行受管集群的平台,如 AWS、GCE 和 Equinix Metal |
|
| true | false | 产品名称,如 OpenShift、Anthos、EKS 和 GKE |
|
| false | false | OpenShift Container Platform 外部 ID,它仅适用于 OpenShift Container Platform 集群 |
|
| false | true | 管理控制台的 URL,仅适用于 OpenShift Container Platform 集群 |
|
| false | true | OpenShift Container Platform 版本,它仅适用于 OpenShift Container Platform 集群 |
如果在受管集群中删除或更新之前的声明,它们会自动恢复或回滚到上一版本。
在受管集群加入 hub 后,在受管集群上创建的 ClusterClaims 与 hub 上的 ManagedCluster 资源的状态同步。带有 ClusterClaims 的受管集群可能类似以下示例:
apiVersion: cluster.open-cluster-management.io/v1
kind: ManagedCluster
metadata:
labels:
cloud: Amazon
clusterID: 95f91f25-d7a2-4fc3-9237-2ef633d8451c
installer.name: multiclusterhub
installer.namespace: open-cluster-management
name: cluster1
vendor: OpenShift
name: cluster1
spec:
hubAcceptsClient: true
leaseDurationSeconds: 60
status:
allocatable:
cpu: '15'
memory: 65257Mi
capacity:
cpu: '18'
memory: 72001Mi
clusterClaims:
- name: id.k8s.io
value: cluster1
- name: kubeversion.open-cluster-management.io
value: v1.18.3+6c42de8
- name: platform.open-cluster-management.io
value: AWS
- name: product.open-cluster-management.io
value: OpenShift
- name: id.openshift.io
value: 95f91f25-d7a2-4fc3-9237-2ef633d8451c
- name: consoleurl.openshift.io
value: 'https://console-openshift-console.apps.xxxx.dev04.red-chesterfield.com'
- name: version.openshift.io
value: '4.5'
conditions:
- lastTransitionTime: '2020-10-26T07:08:49Z'
message: Accepted by hub cluster admin
reason: HubClusterAdminAccepted
status: 'True'
type: HubAcceptedManagedCluster
- lastTransitionTime: '2020-10-26T07:09:18Z'
message: Managed cluster joined
reason: ManagedClusterJoined
status: 'True'
type: ManagedClusterJoined
- lastTransitionTime: '2020-10-30T07:20:20Z'
message: Managed cluster is available
reason: ManagedClusterAvailable
status: 'True'
type: ManagedClusterConditionAvailable
version:
kubernetes: v1.18.3+6c42de8
12.1. 列出现有 ClusterClaims 复制链接链接已复制到粘贴板!
您可以使用 kubectl 命令列出应用到受管集群的 ClusterClaims。当您要将 ClusterClaim 与错误消息进行比较时,这很有用。
备注:请确定您对资源 clusterclaims.cluster.open-cluster-management.io 有 list 权限。
运行以下命令列出受管集群中的所有现有 ClusterClaims:
kubectl get clusterclaims.cluster.open-cluster-management.io