-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from alebedev87/align-with-docs
Align docs with the official OCP ones
- Loading branch information
Showing
2 changed files
with
48 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,78 @@ | ||
# Use ExternalDNS Operator on Openshift in GCP environment | ||
|
||
### This document provides information about how to use the `ExternalDNS Operator` in OpenShift Container Platform on GCP. | ||
|
||
### Steps | ||
1. Export your cluster's kubeconfig | ||
## Steps | ||
1. Export your cluster's kubeconfig: | ||
```bash | ||
$ export KUBECONFIG=/path/to/your/cluster/kubeconfig | ||
$ export KUBECONFIG=/path/to/your/cluster/kubeconfig | ||
``` | ||
|
||
2. Check user. The user shall have the access to `kube-system` namespace. | ||
|
||
2. Make sure your user have the access to `kube-system` namespace: | ||
```bash | ||
$ oc whoami | ||
system:admin | ||
$ oc whoami | ||
system:admin | ||
``` | ||
|
||
3. Copy the value of service_account.json in gcp-credentials secret in a file encoded-gcloud.json | ||
3. Extract the value of `service_account.json` field from `gcp-credentials` secret into a file: | ||
```bash | ||
$ oc get secret gcp-credentials -n kube-system --template='{{$v := index .data "service_account.json"}}{{$v}}' | base64 -d - > decoded-gcloud.json | ||
``` | ||
|
||
4. Export Google credentials | ||
4. Set Google credentials: | ||
```bash | ||
$ export GOOGLE_CREDENTIALS=decoded-gcloud.json | ||
``` | ||
|
||
5. Activate your account | ||
5. Fetch the values from the credentials file: | ||
```bash | ||
$ CLIENT_EMAIL=$(jq -r .client_email < decoded-gcloud.json) | ||
$ PROJECT_ID=$(jq -r .project_id < decoded-gcloud.json) | ||
``` | ||
|
||
6. Activate your account: | ||
```bash | ||
$ gcloud auth activate-service-account <client_email as per decoded-gcloud.json> --key-file=decoded-gcloud.json | ||
$ gcloud auth activate-service-account "${CLIENT_EMAIL}" --key-file=decoded-gcloud.json | ||
``` | ||
|
||
6. Set your project | ||
7. Set your project: | ||
```bash | ||
$ gcloud config set project <project_id as per decoded-gcloud.json> | ||
$ gcloud config set project "${PROJECT_ID}" | ||
``` | ||
|
||
7. Get the routes to check the domain | ||
8. Get the routes to check your cluster's domain (everything after `apps.`): | ||
```bash | ||
$ oc get routes --all-namespaces | grep console | ||
openshift-console console console-openshift-console.apps.qe.gcp.devcluster.openshift.com console https reencrypt/Redirect None | ||
openshift-console downloads downloads-openshift-console.apps.qe.gcp.devcluster.openshift.com downloads http edge/Redirect None | ||
``` | ||
|
||
8. Get your zone which was created by the installer | ||
9. Get your cluster's zone: | ||
```bash | ||
$ gcloud dns managed-zones list | grep <dns name eg- As per the route the section after apps. i.e misalunk-azure.qe.azure.devcluster.openshift.com> | ||
$ gcloud dns managed-zones list | grep qe.gcp.devcluster.openshift.com | ||
qe-cvs4g-private-zone qe.gcp.devcluster.openshift.com | ||
``` | ||
|
||
9. Check the zone doesn't have DNS records other than `NS` and `SOA` | ||
10. Create [ExternalDNS CR](https://github.com/openshift/external-dns-operator/blob/main/config/samples/gcp/operator_v1alpha1_externaldns_openshift.yaml) as follows: | ||
```bash | ||
$ gcloud dns record-sets list --zone=<the zone name you get from step 9> | ||
``` | ||
|
||
10. Create a [ExternalDNS CR](https://github.com/openshift/external-dns-operator/blob/main/config/samples/gcp/operator_v1alpha1_externaldns_openshift.yaml) | ||
```yaml | ||
$ cat <<EOF | oc create -f - | ||
apiVersion: externaldns.olm.openshift.io/v1alpha1 | ||
kind: ExternalDNS | ||
metadata: | ||
name: sample-gcp | ||
spec: | ||
domains: | ||
- filterType: Include | ||
matchType: Exact | ||
name: test-gcp1.qe.gcp.devcluster.openshift.com | ||
- filterType: Include | ||
matchType: Exact | ||
name: qe.gcp.devcluster.openshift.com | ||
provider: | ||
type: GCP | ||
source: | ||
type: OpenShiftRoute | ||
openshiftRouteOptions: | ||
routerName: default | ||
type: OpenShiftRoute | ||
fqdnTemplate: | ||
- "{{.Name}}.apps.test-gcp1.qe.gcp.devcluster.openshift.com" | ||
#You will get this from step 9 | ||
zones: | ||
- test-gcp1-q6m5v-private-zone | ||
EOF | ||
``` | ||
|
||
11. Now you shall see records created for OCP routes using the following command | ||
11. Check the records created for `console` routes: | ||
```bash | ||
$ gcloud dns record-sets list --zone=<zone name you get from step 9> | ||
$ gcloud dns record-sets list --zone= qe-cvs4g-private-zone | grep console | ||
``` | ||
|
||
12. You can try to create a route with a sample app. | ||
```bash | ||
$ oc new-app --docker-image=openshift/hello-openshift -l app=hello-openshift | ||
$ oc expose service/hello-openshift -l app=hello-openshift | ||
``` | ||
|
||
13. Check the record for the hello-openshift route | ||
```bash | ||
$ gcloud dns record-sets list --zone=<zone name you get from step 9> | grep hello-openshift | ||
``` | ||
|
||
14. Similarly you can delete the route and app | ||
```bash | ||
$ oc delete all -l app=hello-openshift | ||
``` | ||
|
||
15. Then again run the command in step 13 to get the records for hello. They should not exist. |