Skip to content

Commit 6d66cb0

Browse files
tjungbauerRobert Bohne
authored and
Robert Bohne
committed
added jq to download packages, updated air-gapped installation doc
1 parent 553e94c commit 6d66cb0

File tree

2 files changed

+100
-33
lines changed

2 files changed

+100
-33
lines changed

ansible/roles/openshift-4-cluster/tasks/prepare-host-CentOS-8.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# ansible virt need lxml
1010
- python3-lxml
1111
- firewalld
12+
- jq
1213
state: present
1314

1415
- name: Upgrade all packages

docs/air-gapped.md

Lines changed: 99 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,81 +2,147 @@
22

33
Some notes how you can setup a air-gapped / disconnected OpenShift 4 cluster with hetzner-ocp4
44

5-
## Create network
5+
## Create ait-gapped configuration file:
6+
To distiguish online & offline configuration file, let's create the file cluster-air-gapped.yml
67

7-
Create only the network, important to install and start the mirror registry add
8-
```
8+
Be sure that the following lines are defined in your configuration file:
9+
10+
```yaml
911
network_forward_mode: "route"
12+
vn_subnet: "192.168.50.0"
1013
```
11-
into `cluster.yml` and setup the network:
14+
15+
## Prepare the installation host
16+
To be sure that all packages are installed accordingly prepare your node:
17+
18+
```bash
19+
# ansible-navigator run ./ansible/01-prepare-host.yml -e @cluster-air-gapped.yml
20+
```
21+
22+
## Create network
1223

1324
```bash
1425
# ansible-navigator run ./ansible/02-create-cluster.yml \
15-
[-e @cluster-air-gapped.yml \]
26+
-e @cluster-air-gapped.yml \
1627
--tags network
1728
```
1829

1930
## Setup mirror registry on kvm-host
2031

21-
### via Office quay mirror registry
32+
### Using Red Hat Mirror Registry
2233

2334
https://docs.openshift.com/container-platform/latest/installing/disconnected_install/installing-mirroring-creating-registry.html
2435

36+
Prepare your node and create certificates for the registry and other stuff.
37+
```bash
38+
# ansible-navigator run ./docs/air-gapped/prep-mirror-registry.yaml -e @cluster-air-gapped.yml
39+
```
40+
41+
Download and extract the mirror-registry binary: (This is currently not done via Ansible)
42+
```bash
43+
mkdir ~/mirror
44+
cd ~/mirror
45+
wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/mirror-registry/latest/mirror-registry.tar.gz
46+
tar -xzvf mirror-registry.tar.gz
2547
```
26-
ansible-navigator run ./docs/air-gapped/prep-mirror-registry.yaml [-e @cluster-air-gapped.yml]
2748

28-
./mirror-registry install \
49+
Create the Mirror Registry
50+
51+
```bash
52+
./mirror-registry install -v \
2953
--quayHostname host.compute.local:5000 \
3054
--quayRoot /var/lib/libvirt/images/mirror-registry/quay/ \
3155
--ssh-key /root/.ssh/id_rsa \
3256
--sslKey /var/lib/libvirt/images/mirror-registry/certs/registry.key \
3357
--sslCert /var/lib/libvirt/images/mirror-registry/certs/registry.crt \
3458
--initPassword r3dh4t\!1
59+
```
3560

61+
Login into the created registry and store the authentication information
62+
63+
```bash
3664
podman login --username init --password r3dh4t\!1 \
3765
--authfile mirror-registry-pullsecret.json \
3866
host.compute.local:5000
3967
```
4068

41-
### via Docker registry - deprecated
69+
## Download Red Hat pull secret
4270

43-
```
44-
./docs/air-gapped/setup-registry.yaml
45-
```
71+
Download Red Hat pull secret from cloud.redhat.com and store it in `redhat-pullsecret.json`
4672

47-
Check registry
48-
```
49-
$ curl -u admin:r3dh4t\!1 https://host.compute.local:5000/v2/_catalog
50-
{"repositories":[]}
51-
```
73+
## Concat redhat pull secret and the authfile created above
5274

53-
Create mirror registry pullsecret
54-
```
55-
podman login --username admin --password r3dh4t\!1 \
56-
--authfile mirror-registry-pullsecret.json \
57-
host.compute.local:5000
75+
Store the result in ~/.docker/config.json
76+
77+
```bash
78+
mkdir ~/.docker
79+
jq -s '{"auths": ( .[0].auths + .[1].auths ) }' mirror-registry-pullsecret.json <path-to-your-redhat-pullsecret> > ~/.docker/config.json
5880
```
5981

82+
## Download OC Client
6083

61-
## Download Red Hat pull secret
84+
Download oc client, oc mirror pluging (and other stuff)
6285

63-
Download Red Hat pull secret and store it in `redhat-pullsecret.json`
86+
```bash
87+
ansible-navigator run ./ansible/02-create-cluster.yml -e @cluster-air-gapped.yml --tags download-openshift-artifacts
88+
```
6489

65-
## Mirror images
90+
## Mirror Images using oc-mirror plugin
6691

67-
Merge mirror-registry-pullsecret.json & redhat-pullsecret.json
68-
```
69-
jq -s '{"auths": ( .[0].auths + .[1].auths ) }' mirror-registry-pullsecret.json redhat-pullsecret.json > pullsecret.json
92+
### Initialize the mirror configuration:
93+
```bash
94+
oc mirror init --registry host.compute.local:5000/mirror/oc-mirror-metadata > imageset-config.yaml
7095
```
7196

72-
Install oc client
97+
This will create a configuration file like the following:
98+
99+
```yaml
100+
kind: ImageSetConfiguration
101+
apiVersion: mirror.openshift.io/v1alpha2
102+
storageConfig:
103+
registry:
104+
imageURL: host.compute.local:5000/mirror/oc-mirror-metadata
105+
skipTLS: false
106+
mirror:
107+
platform:
108+
channels:
109+
- name: stable-4.11
110+
type: ocp
111+
operators:
112+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12
113+
packages:
114+
- name: serverless-operator
115+
channels:
116+
- name: stable
117+
additionalImages:
118+
- name: registry.redhat.io/ubi8/ubi:latest
119+
helm: {}
120+
```
121+
122+
You can add additional Operators, Images or Charts.
123+
124+
### Download Images to local disk
125+
126+
I am downloading it to the local disk first ... just for fun
127+
```bash
128+
mkdir ~/mirror-data/
129+
oc mirror --config=./imageset-config.yaml file:///root/mirror-data/
73130
```
74-
# ansible-navigator run ./ansible/02-create-cluster.yml \
75-
[-e @cluster-air-gapped.yml \]
76-
--tags network
131+
132+
This will download everything into your folder:
133+
```bash
134+
du -sh ~/mirror-data
135+
21G ~/mirror-data
77136
```
78137

79-
Mirror images:
138+
*Note*: If you do not want to download everything locally, your can push them directly into the mirror registry by using `docker://registry.example:5000` instead of `file://...`
139+
140+
### Push everything into the mirror registry
141+
```bash
142+
oc mirror --from=./mirror_seq1_000000.tar docker://host.compute.local:5000/ocp4/openshift4
143+
```
144+
145+
## Mirror images - The old way before OCP 4.11
80146
```
81147
export OCP_RELEASE=$(oc version -o json --client | jq -r '.releaseClientVersion')
82148
export LOCAL_REGISTRY='host.compute.local:5000'

0 commit comments

Comments
 (0)