$ mkdir ibi-config-iso-workdir (1)
您可以使用openshift-install
程序手动生成配置 ISO。将配置 ISO 附加到预安装的目标主机以完成部署。
您可以使用openshift-install
程序配置和部署预安装了基于镜像的安装的主机。要使用特定于站点的详细信息配置目标主机,您必须创建以下资源
install-config.yaml
安装清单
image-based-config.yaml
清单
openshift-install
程序使用这些资源生成一个配置 ISO,您可以将其附加到预安装的目标主机以完成部署。
有关 |
您使用基于镜像的安装预安装了具有单节点 OpenShift 的主机。
您下载了最新版本的openshift-install
程序。
您创建了一个拉取密钥来验证拉取请求。有关更多信息,请参阅“使用镜像拉取密钥”。
通过运行以下命令创建一个工作目录
$ mkdir ibi-config-iso-workdir (1)
1 | 将ibi-config-iso-workdir 替换为您工作目录的名称。 |
创建安装清单
创建一个定义install-config
清单的 YAML 文件
install-config.yaml
文件示例apiVersion: v1
metadata:
name: sno-cluster-name
baseDomain: host.example.com
compute:
- architecture: amd64
hyperthreading: Enabled
name: worker
replicas: 0
controlPlane:
architecture: amd64
hyperthreading: Enabled
name: master
replicas: 1
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
machineNetwork:
- cidr: 192.168.200.0/24
networkType: OVNKubernetes
serviceNetwork:
- 172.30.0.0/16
platform:
none: {}
fips: false
cpuPartitioningMode: "AllNodes"
pullSecret: '{"auths":{"<your_pull_secret>"}}}'
sshKey: 'ssh-rsa <your_ssh_pub_key>'
如果您的集群部署需要代理配置,则必须执行以下操作
|
将文件保存在您的工作目录中。
可选。通过运行以下命令在您的工作目录中创建一个配置模板
$ openshift-install image-based create config-template --dir ibi-config-iso-workdir/
INFO Config-Template created in: ibi-config-iso-workdir
该命令在您的工作目录中创建image-based-config.yaml
配置模板
#
# Note: This is a sample ImageBasedConfig file showing
# which fields are available to aid you in creating your
# own image-based-config.yaml file.
#
apiVersion: v1beta1
kind: ImageBasedConfig
metadata:
name: example-image-based-config
additionalNTPSources:
- 0.rhel.pool.ntp.org
- 1.rhel.pool.ntp.org
hostname: change-to-hostname
releaseRegistry: quay.io
# networkConfig contains the network configuration for the host in NMState format.
# See https://nmstate.io/examples.html for examples.
networkConfig:
interfaces:
- name: eth0
type: ethernet
state: up
mac-address: 00:00:00:00:00:00
ipv4:
enabled: true
address:
- ip: 192.168.122.2
prefix-length: 23
dhcp: false
编辑您的配置文件
image-based-config.yaml
文件示例#
# Note: This is a sample ImageBasedConfig file showing
# which fields are available to aid you in creating your
# own image-based-config.yaml file.
#
apiVersion: v1beta1
kind: ImageBasedConfig
metadata:
name: sno-cluster-name
additionalNTPSources:
- 0.rhel.pool.ntp.org
- 1.rhel.pool.ntp.org
hostname: host.example.com
releaseRegistry: quay.io
# networkConfig contains the network configuration for the host in NMState format.
# See https://nmstate.io/examples.html for examples.
networkConfig:
interfaces:
- name: ens1f0
type: ethernet
state: up
ipv4:
enabled: true
dhcp: false
auto-dns: false
address:
- ip: 192.168.200.25
prefix-length: 24
ipv6:
enabled: false
dns-resolver:
config:
server:
- 192.168.15.47
- 192.168.15.48
routes:
config:
- destination: 0.0.0.0/0
metric: 150
next-hop-address: 192.168.200.254
next-hop-interface: ens1f0
通过运行以下命令在您的工作目录中创建配置 ISO
$ openshift-install image-based create config-image --dir ibi-config-iso-workdir/
INFO Adding NMConnection file <ens1f0.nmconnection>
INFO Consuming Install Config from target directory
INFO Consuming Image-based Config ISO configuration from target directory
INFO Config-Image created in: ibi-config-iso-workdir/auth
查看工作目录中的输出
ibi-config-iso-workdir/
├── auth
│ ├── kubeadmin-password
│ └── kubeconfig
└── imagebasedconfig.iso
使用您首选的方法将imagebasedconfig.iso
附加到预安装的主机,然后重新启动主机以完成配置过程并部署集群。
主机上的配置过程完成后,访问集群以验证其状态。
通过运行以下命令将kubeconfig
环境变量导出到您的 kubeconfig 文件
$ export KUBECONFIG=ibi-config-iso-workdir/auth/kubeconfig
通过运行以下命令验证集群是否正在响应
$ oc get nodes
NAME STATUS ROLES AGE VERSION
node/sno-cluster-name.host.example.com Ready control-plane,master 5h15m v1.30.3
以下内容描述了image-based-config.yaml
清单的规范。
openshift-install
程序使用image-based-config.yaml
清单为单节点 OpenShift 的基于镜像的部署创建一个特定于站点的配置 ISO。
规范 | 类型 | 描述 |
---|---|---|
|
|
定义单节点 OpenShift 集群的节点名称。 |
规范 | 类型 | 描述 | ||
---|---|---|---|---|
|
|
指定主机的网络配置,例如
如果您需要静态网络,则必须在创建实时安装 ISO 的主机上安装
|
||
|
|
指定所有集群主机的 NTP 源列表。这些 NTP 源将添加到集群中任何现有的 NTP 源。您可以使用 NTP 源的主机名或 IP 地址。 |
||
|
|
指定您用于种子集群的发布镜像的容器镜像注册表。 |
||
|
|
指定单节点 OpenShift 节点的自定义节点标签,例如
|
您可以选择在单节点 OpenShift 集群的基于镜像的部署中定义其他资源。
在与包含install-config.yaml
和image-based-config.yaml
清单的同一工作目录中,在extra-manifests
文件夹中创建其他资源。
|
您可以在工作目录的extra-manifests
文件夹中创建一个资源,以将额外的清单添加到单节点 OpenShift 集群的基于镜像的部署中。
以下示例将单根 I/O 虚拟化 (SR-IOV) 网络添加到部署中。
您创建了一个包含install-config.yaml
和image-based-config.yaml
清单的工作目录
转到您的工作目录,并通过运行以下命令创建extra-manifests
文件夹
$ mkdir extra-manifests
在extra-manifests
文件夹中创建SriovNetworkNodePolicy
和SriovNetwork
资源
创建一个定义资源的 YAML 文件
sriov-extra-manifest.yaml
文件示例apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
name: "example-sriov-node-policy"
namespace: openshift-sriov-network-operator
spec:
deviceType: vfio-pci
isRdma: false
nicSelector:
pfNames: [ens1f0]
nodeSelector:
node-role.kubernetes.io/master: ""
mtu: 1500
numVfs: 8
priority: 99
resourceName: example-sriov-node-policy
---
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
name: "example-sriov-network"
namespace: openshift-sriov-network-operator
spec:
ipam: |-
{
}
linkState: auto
networkNamespace: sriov-namespace
resourceName: example-sriov-node-policy
spoofChk: "on"
trust: "off"
创建配置 ISO 时,您可以在工作目录中的.openshift_install_state.json
文件中查看对额外清单的引用
"*configimage.ExtraManifests": {
"FileList": [
{
"Filename": "extra-manifests/sriov-extra-manifest.yaml",
"Data": "YXBFDFFD..."
}
]
}