OC Mirror
- Need at least one Operator:
1kind: ImageSetConfiguration
2apiVersion: mirror.openshift.io/v1alpha2
3archiveSize: 4
4storageConfig:
5 registry:
6 imageURL: quay.example.com:8443/mirror/oc-mirror-metadata
7 skipTLS: false
8mirror:
9 platform:
10 architectures:
11 - "amd64"
12 channels:
13 - name: stable-4.14
14 type: ocp
15 shortestPath: true
16 graph: true
17 operators:
18 - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
19 packages:
20 - name: kubevirt-hyperconverged
21 channels:
22 - name: 'stable'
23 - name: serverless-operator
24 channels:
25 - name: 'stable'
26 additionalImages:
27 - name: registry.redhat.io/ubi9/ubi:latest
28 helm: {}
1# install oc-mirror:
2curl https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest/oc-mirror.rhel9.tar.gz -O
3
4# Get an example of imageset
5oc-mirror init --registry quay.example.com:8443/mirror/oc-mirror-metadata
6
7# Find operators in the list of Operators, channels, packages
8oc-mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.14
9oc-mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.14 --package=kubevirt-hyperconverged
10oc-mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.14 --package=kubevirt-hyperconverged --channel=stable
11
12# mirror with a jumphost which online access
13oc-mirror --config=imageset-config.yaml docker://quay.example.com:8443
14
15# mirror for airgap
16oc-mirror --config=imageSetConfig.yaml file://tmp/download
17oc-mirror --from=/tmp/upload/ docker://quay.example.com/ocp/operators
18
19# Refresh OperatorHub
20oc get pod -n openshift-marketplace
21
22# Get the index pod and delete it to refresh
23oc delete pod cs-redhat-operator-index-m2k2n -n openshift-marketplace
Install
1## Get the coreOS which is gonna to be installed
2openshift-install coreos print-stream-json | grep '\.iso[^.]'
3
4openshift-install create install-config
5openshift-install create ignition-configs
6openshift-install create cluster --dir . --log-level=info
7openshift-install destroy cluster --log-level=info
- for baremetal make a iso boot USB
1dd if=$HOME/ocp-latest/rhcos-live.iso of=/dev/sdb bs=1024k status=progress
Add node
1export OPENSHIFT_CLUSTER_ID=$(oc get clusterversion -o jsonpath='{.items[].spec.clusterID}')
2export CLUSTER_REQUEST=$(jq --null-input --arg openshift_cluster_id "$OPENSHIFT_CLUSTER_ID" '{
3 "api_vip_dnsname": "<api_vip>",
4 "openshift_cluster_id": $openshift_cluster_id,
5 "name": "<openshift_cluster_name>"
6}')
Platform in install-config
1## none
2platform:
3 none: {}
4
5## baremetal - use ipmi to provision baremetal
6platform:
7 baremetal:
8 apiVIP: 192.168.111.5
9 ingressVIP: 192.168.111.7
10 provisioningNetwork: "Managed"
11 provisioningNetworkCIDR: 172.22.0.0/24
12 provisioningNetworkInterface: eno1
13 clusterProvisioningIP: 172.22.0.2
14 bootstrapProvisioningIP: 172.22.0.3
15 hosts:
16 - name: master-0
17 role: master
18 bmc:
19 address: ipmi://192.168.111.1
20 username: admin
21 password: password
22 bootMACAddress: 52:54:00:a1:9c:ae
23 hardwareProfile: default
24 - name: master-1
25 role: master
26 bmc:
27 address: ipmi://192.168.111.2
28 username: admin
29 password: password
30 bootMACAddress: 52:54:00:a1:9c:af
31 hardwareProfile: default
32 - name: master-2
33 role: master
34 bmc:
35 address: ipmi://192.168.111.3
36 username: admin
37 password: password
38 bootMACAddress: 52:54:00:a1:9c:b0
39 hardwareProfile: default
40
41## vpshere - old syntax and deprecated form (new one in 4.15 with "failure domain")
42vsphere:
43 vcenter:
44 username:
45 password:
46 datacenter:
47 defaultDatastore:
48 apiVIPs:
49 - x.x.x.x
50 ingressVIPs:
51 - x.x.x.x
52
53## new syntax
54platform:
55 vsphere:
56 apiVIPs:
57 - x.x.x.x
58 datacenter: xxxxxxxxxxxx_datacenter
59 defaultDatastore: /xxxxxxxxxxxx_datacenter/datastore/Shared Storages/ssd-001602
60 failureDomains:
61 - name: CNV4
62 region: fr
63 server: xxxxxxxxxxxx.ovh.com
64 topology:
65 computeCluster: /xxxxxxxxxxxx_datacenter/host/Management Zone Cluster
66 datacenter: xxxxxxxxxxxx_datacenter
67 datastore: /xxxxxxxxxxxx_datacenter/datastore/Shared Storages/ssd-001602
68 networks:
69 - vds_mgmt
70 zone: dc
71 ingressVIPs:
72 - x.x.x.x
73 password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
74 username: admin
75 vCenter: xxxxxxxxxxx.ovh.com
76 vcenters:
77 - datacenters:
78 - xxxxxxxxxx_datacenter
79 password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
80 port: 443
81 server: xxxxxxx.ovh.com
82 user: admin
Utils
1# Get Cluster ID
2oc get clusterversion -o jsonpath='{.items[].spec.clusterID}'
3
4# Get Nodes which are Ready
5oc get nodes --output jsonpath='{range .items[?(@.status.conditions[-1].type=="Ready")]}{.metadata.name} {.status.conditions[-1].type}{"\n"}{end}'
6
7# get images from all pods in a namespace
8oc get pods -n --output jsonpath='{range .items[*]}{.spec.containers[*].image}{"\n"}{end}'
Set OperatorHub
- in airgap
1oc get catalogsources -n openshift-marketplace
Comments