Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 965e277

Browse files
authored
Merge pull request #5 from jtudelag/improve-aws-docs
Enhance AWS docs
2 parents 524fb36 + c1311ab commit 965e277

File tree

1 file changed

+154
-10
lines changed
  • sites/staging-edge.devcluster.openshift.com

1 file changed

+154
-10
lines changed
Lines changed: 154 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,76 @@
1-
## How to deploy staging-edge cluster on AWS
1+
# How to deploy a site cluster on AWS
2+
3+
This is a two step process:
4+
5+
1. First the user has to define its site cluster and push it to its git reporistory.
6+
2. Then, the user shoud use `knictl` to render all the manifests, and run the OCP instaler.
7+
8+
## Define your site cluster
9+
10+
### Create site folder
11+
12+
First of all, you have to clone this repo, and use one of the site clusters as a baseline:
13+
14+
For example, if you want to deploy a new cluster (site) on AWS, you can copy the site `staging-edge.devcluster.openshift.com`.
15+
16+
For the purpose of this example, we are assuming the new site is called: `staging-edge.devcluster.openshift.com` and the profile `production.aws`.
17+
18+
```bash
19+
export SITE_NAME='staging-edge.devcluster.openshift.com'
20+
export PROFILE_NAME='production.aws'
21+
22+
cd blueprint-industrial-edge/sites
23+
cp -a staging-edge.devcluster.openshift.com/ "$SITE_NAME/"
24+
```
25+
26+
### Edit profile requirements
27+
28+
The user should know which exact version of OCP wants to deploy, and should edit the `requirements.yaml` file
29+
accordingly, to download the right client tools versions.
30+
31+
Also, the user should know which version of kubernetes is using the exact version of OCP.
32+
33+
For example, for OCP 4.4, k8s 1.17 is used. The user should always check [OCP release notes](https://docs.openshift.com/container-platform/4.4/release_notes/ocp-4-4-release-notes.html#ocp-4-4-about-this-release) before.
34+
35+
```bash
36+
cd blueprint-industrial-edge/profiles/
37+
vi "$PROFILE_NAME/requirements.yaml"
38+
```
39+
40+
#### Edit 00_install
41+
42+
```bash
43+
cd blueprint-industrial-edge/sites/$SITE_NAME/00_install-config
44+
```
45+
46+
+ **kustomization.yaml** -> Change git url.
47+
+ **install-config.patch.yaml** -> Change baseDomain, and alterantively other fields, such as the aws zone for example.
48+
+ **install-config.name.patch.yaml** -> Change the cluster-name.
49+
50+
#### Edit 02_cluster_addons
51+
52+
If registering the site againts a RHACM hub, then:
53+
54+
```bash
55+
cd blueprint-industrial-edge/sites/$SITE_NAME/02_cluster_addons/00_acm_registration
56+
```
57+
58+
+ **acm-name-config.patch.yaml** -> Change clusterName and clusterNamespace, use the same value.
59+
60+
##### Git push
61+
62+
Push the changes to your repo, the url go the git repo should match the git url you have specified in previous steps:
63+
64+
```bash
65+
cd blueprint-industrial-edge
66+
git add .
67+
git commit -m "Adds my new blueprint site"
68+
git push <my-remote> master
69+
```
70+
71+
## Deploy your site cluster
72+
73+
### AWS credentials
274

375
First of all you need to have your Amazon Web Service credentials file located in the following path:
476

@@ -12,22 +84,94 @@ aws_access_key_id = xxxx
1284
aws_secret_access_key = xxxx
1385
```
1486

15-
The OpenShift installer binary will read that file if aws is set as a platform. From the path where the `knictl` binary is located, and in order to pull our staging-edge site and its requirements, please execute:
87+
The OpenShift installer binary will read that file if aws is set as a platform.
1688

17-
`knictl fetch_requirements github.com/redhat-edge-computing/blueprint-industrial-edge/sites/staging-edge.devcluster.openshift.com/`
89+
### Prepare .kni folder
1890

19-
This command will download the site blueprint definition, and all its requirements (oc, openshift-install, kustomize, etc) to the `$HOME/.kni/`. Every site will have a separate directory within that location. The next step involves the actual rendering of the manifests (site + profile + base) into one set of manifests via kustomize that we can pass to the openshift-install binary.
91+
Your `.kni/` folder should contain the following files, otherwise either your deployment or Day 2 workloads will fail to be deployed.
2092

21-
`knictl prepare_manifests staging-edge.devcluster.openshift.com`
93+
```bash
94+
tree .kni/
95+
.
96+
├── dockerconfig.json
97+
├── id_rsa
98+
├── id_rsa.pub
99+
├── kubeconfighub.json
100+
├── pull-secret.json
101+
```
102+
103+
+ **dockerconfig.json:** It is a valid pull secret to pull RHACM images on the registered cluster. Only needed if you want your OCP cluster to be autoregisters against a RHACM Hub cluster.
104+
105+
It is basically a base64 encoded pull secret. To generate it, just execute:
106+
107+
```bash
108+
cd ~/.kni/
109+
cat pull-secret.json | base64 -w0 > ~/.kni/dockerconfig.json
110+
```
111+
112+
+ **kubeconfighub.json:** It is the the kubeconfig of the RHACM hub cluster, base64 encoded. It is used by the RHACM Endpoint pod to register itself against the RHACM.
113+
114+
To generate it, just execute:
115+
116+
```bash
117+
cat rhacm-hub-kubeconfig | base64 -w0 > ~/.kni/kubeconfighub.json
118+
```
119+
120+
### Environment vars & aliases
121+
122+
Define the following var and aliases, according to your needs.
123+
124+
```bash
125+
export SITE_NAME='staging-edge.devcluster.openshift.com'
126+
export GIT_REPO='github.com/redhat-edge-computing/blueprint-industrial-edge'
127+
alias openshift-install="$HOME/.kni/$SITE_NAME/requirements/openshift-install"
128+
```
129+
130+
### kncitl: Preparation steps
131+
132+
From the path where the `knictl` binary is located, and in order to pull our site and its requirements, please execute:
22133

23-
If everything goes well, the command will get out some instructions to deploy the cluster. It's basically asking you to run `openshift-install` binary pointing to where the final manifests created by `knictl` are:
134+
```bash
135+
knictl fetch_requirements "$GIT_REPO/sites/$SITE_NAME/"
136+
```
137+
138+
This command will download the site blueprint definition, and all its requirements (oc, openshift-install, kustomize, etc) to the `$HOME/.kni/`. Every site will have a separate directory within that location.
139+
140+
The next step involves the actual rendering of the manifests (site + profile + base) into one set of manifests via kustomize that we can pass to the openshift-install binary.
141+
142+
```bash
143+
knictl prepare_manifests "$SITE_NAME"
144+
```
145+
146+
If everything goes well, the command will get out some instructions to deploy the cluster. It's basically asking you to run `openshift-install` binary pointing to where the final manifests created by `knictl` are.
24147

25-
`$HOME/.kni/staging-edge.devcluster.openshift.com/requirements/openshift-install create cluster --dir=$HOME/.kni/staging-edge.gcp.devcluster.openshift.com/final_manifests --log-level debug`
148+
### Deploy OpenShift
26149

27-
Wait until the deployment is completed, and you will information about console endpoint, kubeadmin password and kubeconfig path.
150+
Just execute the following command:
151+
152+
```bash
153+
openshift-install create cluster --dir="$HOME/.kni/$SITE_NAME/final_manifests" --log-level debug
154+
```
28155

29-
If you have manifests that you want to deploy as Day 2 operations located in any of the 02_cluster-addons or 03_services directories, you can deploy them running the following command:
156+
Wait until the deployment is completed, and you will information about console endpoint, kubeadmin password and kubeconfig path.
30157

31-
`knictl apply_workloads staging-edge.devcluster.openshift.com`
158+
### knictl: deploy Day 2 workloads
159+
160+
If you have manifests that you want to deploy as Day 2 operations located in any of the `02_cluster-addons` or `03_services directories`, you can deploy them running the following command:
161+
162+
```bash
163+
knictl apply_workloads "$SITE_NAME"
164+
```
32165

33166
This is basically running kustomize to build and render all the manifests enabling alpha plugins, and apply them via oc/kubectl.
167+
168+
**NOTE:**: If for some reasons the previous command fails, you can check the kustomize rendered manifests under `/tmp`,
169+
or under `~/.kni/tmp` if using a containerized version of knictl.
170+
171+
### Destroy OpenShift cluster
172+
173+
To destroy your site cluster:
174+
175+
```bash
176+
openshift-install destroy cluster --dir="$HOME/.kni/$SITE_NAME/final_manifests" --log-level debug
177+
```

0 commit comments

Comments
 (0)