13.5. Cluster API 机器的配置选项
13.5.1. Amazon Web Services 的集群 API 配置选项 复制链接链接已复制到粘贴板!
使用集群 API 管理机器只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。
有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围。
您可以通过更新 Cluster API 自定义资源清单中的值来更改 Amazon Web Services (AWS) 集群 API 机器的配置。
13.5.1.1. 用于配置 Amazon Web Services 集群的 YAML 示例 复制链接链接已复制到粘贴板!
以下示例 YAML 文件显示了 Amazon Web Services 集群的配置。
基础架构资源是特定于提供程序的,定义由集群中所有计算机器集(如地区和子网)共享的属性。计算机器集在创建机器时引用此资源。
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSCluster
metadata:
name: <cluster_name>
namespace: openshift-cluster-api
spec:
controlPlaneEndpoint:
host: <control_plane_endpoint_address>
port: 6443
region: <region>
机器模板资源是特定于提供程序的,定义计算机器创建的机器的基本属性。计算机器设置在创建机器时引用此模板。
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSMachineTemplate
metadata:
name: <template_name>
namespace: openshift-cluster-api
spec:
template:
spec:
uncompressedUserData: true
iamInstanceProfile: # ...
instanceType: m5.large
cloudInit:
insecureSkipSecretsManager: true
ami:
id: # ...
subnet:
filters:
- name: tag:Name
values:
- # ...
additionalSecurityGroups:
- filters:
- name: tag:Name
values:
- # ...
计算机器设置资源定义它所创建的机器的额外属性。计算机器集也会在创建机器时引用基础架构资源和机器模板。
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
name: <machine_set_name>
namespace: openshift-cluster-api
spec:
clusterName: <cluster_name>
replicas: 1
selector:
matchLabels:
test: example
template:
metadata:
labels:
test: example
spec:
bootstrap:
dataSecretName: worker-user-data
clusterName: <cluster_name>
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSMachineTemplate
name: <template_name>
13.5.2. Google Cloud 的集群 API 配置选项 复制链接链接已复制到粘贴板!
使用集群 API 管理机器只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。
有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围。
您可以通过更新 Cluster API 自定义资源清单中的值来更改 Google Cloud Cluster API 机器的配置。
13.5.2.1. 用于配置 Google Cloud 集群的 YAML 示例 复制链接链接已复制到粘贴板!
以下示例 YAML 文件显示 Google Cloud 集群的配置。
基础架构资源是特定于提供程序的,定义由集群中所有计算机器集(如地区和子网)共享的属性。计算机器集在创建机器时引用此资源。
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPCluster
metadata:
name: <cluster_name>
spec:
controlPlaneEndpoint:
host: <control_plane_endpoint_address>
port: 6443
network:
name: <cluster_name>-network
project: <project>
region: <region>
机器模板资源是特定于提供程序的,定义计算机器创建的机器的基本属性。计算机器设置在创建机器时引用此模板。
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPMachineTemplate
metadata:
name: <template_name>
namespace: openshift-cluster-api
spec:
template:
spec:
rootDeviceType: pd-ssd
rootDeviceSize: 128
instanceType: n1-standard-4
image: projects/rhcos-cloud/global/images/rhcos-411-85-202203181601-0-gcp-x86-64
subnet: <cluster_name>-worker-subnet
serviceAccounts:
email: <service_account_email_address>
scopes:
- https://www.googleapis.com/auth/cloud-platform
additionalLabels:
kubernetes-io-cluster-<cluster_name>: owned
additionalNetworkTags:
- <cluster_name>-worker
ipForwarding: Disabled
计算机器设置资源定义它所创建的机器的额外属性。计算机器集也会在创建机器时引用基础架构资源和机器模板。
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
name: <machine_set_name>
namespace: openshift-cluster-api
spec:
clusterName: <cluster_name>
replicas: 1
selector:
matchLabels:
test: example
template:
metadata:
labels:
test: example
spec:
bootstrap:
dataSecretName: worker-user-data
clusterName: <cluster_name>
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPMachineTemplate
name: <template_name>
failureDomain: <failure_domain>