Installing with a bastion host
You can use a bastion host to perform an air-gapped installation of API Connect for GraphQL on Red Hat OpenShift Container Platform (OCP) or Native Kubernetes environment when your cluster has no internet connectivity.
This task must be performed by a Red Hat OpenShift or Kubernetes administrator. If your cluster is not connected to the internet, you can mirror product images to a registry in your network-restricted environment by using a bastion host. A bastion host has access to both the public internet and the network-restricted environment where the target clusters reside. You can fetch product images from the internet and push them to a local registry; then you can pull the images from the local registry to the target cluster for installation.
- Set up the mirroring environment.
- Prepare the target cluster:
- Deploy a supported version of Red Hat OpenShift Container Platform (OCP) or Native Kubernetes (K8S) as a cluster.
- Configure storage on the cluster and make sure that it is available.
- Prepare the bastion host:
You must be able to connect your bastion host to the internet and to the restricted network environment (with access to the Red Hat OpenShift Container Platform (OCP) or Native Kubernetes (K8S) cluster and the local registry) at the same time. Your host must be on a Linux x86_64 or Mac platform with any operating system that the Red Hat OpenShift Client or Native Kubernetes (K8S) supports (in Windows, execute the actions in a Linux x86_64 VM or from a Windows Subsystem for Linux terminal).
- Ensure that the sites and ports listed in Table 1 can be reached from the bastion host:
Table 1. Sites that must be reached from the bastion host Site Description icr.io:443IBM entitled registry cp.icr.io:443IBM Cloudpak registry quay.io:443Local API Connect for GraphQL Software image repository github.comCASE files and tools redhat.comRed Hat OpenShift Container Platform (OCP) upgrades - Install the dependency packages on the bastion host.
- For Red Hat OpenShift environment
- install Podman. Podman is used for managing containers. To install Podman, see the Podman installation instructions. For example, on Red Hat Enterprise Linux 9, install Podman with the following command:
yum install podman - Install the Red Hat OpenShift Client tool (
oc) as explained in Getting started with the OpenShift CLI.The
octool is used for managing Red Hat OpenShift resources in the cluster. - Download the IBM Catalog Management Plug-in for IBM Cloud Paks version
1.1.0 or later from GitHub.The
ibm-pakplug-in enables you to access hosted product images, and to runoc ibm-pakcommands against the cluster. To confirm thatibm-pakis installed, run the following command and verify that the response lists the command usage:oc ibm-pak --help
- install Podman. Podman is used for managing containers. To install Podman, see the Podman installation instructions.
- For Native Kubernetes environment
- Install
skopeo.skopeois used for managing containers.For example, on Red Hat Enterprise Linux 9, installskopeousing the following command:yum install skopeo - Install kubectl tool.
- Download the IBM Catalog Management Plug-in for IBM Cloud Pak version
1.1.0 or later from GitHub. After extracting the IBM Cloud Pak version,
enter the following command inside the extracted IBM Cloud Pak folder.
cp oc-ibm_pak-<OS>-<architecture type> /usr/local/bin/kubectl-ibm_pakFor example, in case of Linux OS:cp oc-ibm_pak-linux-amd64 /usr/local/bin/kubectl-ibm_pakTheibm-pakplug-in enables you to access hosted product images, and to runkubectl ibm-pakcommands against the cluster. To confirm thatibm-pakis installed, run the following command and verify that the response lists the command usage:kubectl ibm-pak --help
- Install
- For Red Hat OpenShift environment
- Ensure that the sites and ports listed in Table 1 can be reached from the bastion host:
- Set up a local image registry and credentials.
The local Docker registry stores the mirrored images in your network-restricted environment.
- Install a registry, or get access to an existing registry.
You might already have access to one or more centralized, corporate registry servers to store the API Connect Essentials images. If not, then you must install and configure a production-grade registry before proceeding.
The registry product that you use must meet the following requirements:- Supports multi-architecture images through Docker Manifest V2, Schema
2
For details, see Docker Manifest V2, Schema 2.
- Is accessible from the Red Hat OpenShift Container Platform cluster nodes
- Allows path separators in the image name
Note: Do not use the Red Hat OpenShift image registry as your local registry because it does not support multi-architecture images or path separators in the image name. - Supports multi-architecture images through Docker Manifest V2, Schema
2
- Configure the registry to meet the following requirements:
- Supports auto-repository creation
- Has sufficient storage to hold all of the software that is to be transferred
- Has the credentials of a user who can create and write to repositories (the mirroring process uses these credentials)
- Has the credentials of a user who can read all repositories (the Red Hat OpenShift Container Platform cluster uses these credentials)
To access your registries during an air-gapped installation, use an account that can write to the target local registry. To access your registries during runtime, use an account that can read from the target local registry.
- Install a registry, or get access to an existing registry.
- Prepare the target cluster:
- [This is applicable only for Red Hat OpenShift environment.] Mirror the cert-manager
operator for Red Hat OpenShift.
It is recommended to use the cert-manager operator for Red Hat OpenShift. Mirror the operator as explained in the Red Hat instructions: Mirroring images for a disconnected installation using the oc-mirror plugin .
When you modify theImageSetConfiguration, includeopenshift-cert-manager-operatorat channelstable-v1as one of the packages, as shown in the following example:packages: - name: openshift-cert-manager-operator channels: - name: stable-v1 - Set environment variables and download CASE files.
Because you will use values from two different CASE files, you must create environment variables for both; notice that the variables for the foundational services (common services) CASE file are prefixed with "CS_" to differentiate them.
- Create the following environment variables with the installer image name and the image inventory
on your host:
export CASE_NAME=ibm-stepzen-case export CASE_VERSION=<version+timestamp> export ARCH=amd64 - Connect your host to the internet (it does not need to be connected to the network-restricted environment at this time).
- Download the CASE files to your portable device:
For Red Hat OpenShift envt: oc ibm-pak get $CASE_NAME --version $CASE_VERSION For Native Kubernetes envt: kubectl ibm-pak get $CASE_NAME --version $CASE_VERSION
- Create the following environment variables with the installer image name and the image inventory
on your host:
- Mirror the images.
The process of mirroring images pulls the images from the internet and pushes them to your local registry. After mirroring your images, you can configure your cluster and pull the images to it before installing API Connect for GraphQL Software.
- Generate mirror manifests.
- Define the environment variable $TARGET_REGISTRY by running the following command:
Replaceexport TARGET_REGISTRY=<target-registry><target-registry>with the IP address (or host name) and port of the local registry; for example:172.16.0.10:5000. If you want the images to use a specific namespace within the target registry, you can specify it here; for example:172.16.0.10:5000/registry_ns. - Generate mirror manifests by running the following
commands:
For Red Hat OpenShift envt: oc ibm-pak generate mirror-manifests $CASE_NAME --version $CASE_VERSION $TARGET_REGISTRY For Native Kubernetes envt: kubectl ibm-pak generate mirror-manifests $CASE_NAME --version $CASE_VERSION $TARGET_REGISTRYIf you need to filter for a specific image group, add the parameter
--filter <image_group>to the command.
Thegeneratecommand creates the following files at ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION:- catalog-sources.yaml
- catalog-sources-linux-<arch>.yaml (if there are architecture-specific catalog sources)
- image-content-source-policy.yaml
- images-mapping.txt
The files are used when mirroring the images to the
TARGET_REGISTRY. - Define the environment variable $TARGET_REGISTRY by running the following command:
- Obtain an entitlement key for the entitled registry where the images are hosted:
- Log in to the IBM Container Library.
- In the Container software library, select Get entitlement key.
- In the "Access your container software" section, click Copy key.
- Copy the key to a safe location; you will use it to log in to
cp.icr.ioin the next step.
- Authenticate with the entitled registry where the images are hosted.
The image pull secret allows you to authenticate with the entitled registry and access product images.
- Run the following command to export the path to the file that will store the authentication
credentials that are generated on a Podman or Docker
login:
export REGISTRY_AUTH_FILE=$HOME/.docker/config.jsonThe authentication file is typically located at $HOME/.docker/config.json on Linux or %USERPROFILE%/.docker/config.json on Windows.
- Log in to the
cp.icr.ioregistry.- For Red Hat OpenShift, use Podman; for
example:
podman login cp.icr.ioUse
cpas the username and your entitlement key as the password. - For Native Kubernetes, use
skopeo; for example:skopeo login cp.icr.io
- For Red Hat OpenShift, use Podman; for
example:
- Run the following command to export the path to the file that will store the authentication
credentials that are generated on a Podman or Docker
login:
- Authenticate with the local registry.
- For Red Hat OpenShift, use Podman; for example:
Log in to the local registry using an account that can write images to that registry; for example:
podman login $TARGET_REGISTRYIf the registry is insecure, add the following flag to the command:
--tls-verify=false. - For Native Kubernetes, use
skopeo; for example:Log in to the local registry using an account that can write images to that registry; for example:
skopeo login $TARGET_REGISTRYIf the registry is insecure, add the following flag to the command:
--tls-verify=false.
- For Red Hat OpenShift, use Podman; for example:
- Mirror the product images.
- Connect the bastion host to both the internet and the restricted-network environment that contains the local registry.
- Run the following commands to copy the images to the local registry:
- For Red Hat OpenShift Container Platform, use the following
command:
oc image mirror \ -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping.txt \ -a $REGISTRY_AUTH_FILE \ --filter-by-os '.*' \ --skip-multiple-scopes \ --max-per-registry=1Note: If the local registry is not secured by TLS, or the certificate presented by the local registry is not trusted by your device, add the--insecureoption to the command.There might be a slight delay before you see a response to the command.
- For Native Kubernetes environment, use the following command:
This command generates the list ofcat ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/images-mapping.txt | awk -F'=' '{ print "skopeo copy --all docker://"$1" docker://"$2 }'skopeocommands as shown in the example.
Execute these commands sequentially.
- For Red Hat OpenShift Container Platform, use the following
command:
- Configure the target cluster.
-
For Red Hat OpenShift Container Platform, perform the following steps:
-
After mirroring the images to the local registry, you need to configure the target cluster to pull images from it. Follow these steps to set up the cluster's global pull secret with the local registry's credentials and direct the cluster to retrieve images from the local registry.
- Log in to your Red Hat OpenShift Container Platform
cluster:
oc login <openshift_url> -u <username> -p <password> -n <namespace> - Update the global image pull secret for the cluster as
explained in the Red Hat OpenShift Container Platform documentation.Note: If you have an insecure registry, add the registry to the cluster's
insecureRegistrieslist by running the following command:
and add the TARGET_REGISTRY tooc edit image.config.openshift.io/cluster -o yamlspec.registrySources.insecureRegistriesas shown in the following example:
If thespec: registrySources: insecureRegistries: - insecure0.svc:5001 - <TARGET_REGISTRY>insecureRegistriesfield does not exist, you can add it. - Create the ImageContentSourcePolicy, which instructs the cluster to pull the images from your
local
registry:
oc apply -f ~/.ibm-pak/data/mirror/$CASE_NAME/$CASE_VERSION/image-content-source-policy.yaml - Verify that the ImageContentSourcePolicy resource was
created:
oc get imageContentSourcePolicy - Verify your cluster node status:
oc get MachineConfigPool -wWait for all nodes to be updated before proceeding to the next step.
- Log in to your Red Hat OpenShift Container Platform
cluster:
-
- For Native Kubernetes environment, perform the followings steps:
- Add host aliases for
cp.icr.ioandicr.ioso that it points to your local registry. You can set the host aliases based on pod level or cluster level settings. Refer to Adding entries to Pod /etc/hosts with HostAliases for more details. - Make sure that the host aliases redirects to your target mirrored registry.
- Add host aliases for
-
For Red Hat OpenShift Container Platform, perform the following steps:
- Install the operator.
- Create a namespace (project).
- (Optional) Update the operator to define a custom namespace.
By default, the operator looks for a namespace called
stepzen. If you want to use thestepzennamespace, skip this step.Run the following command to replace all occurrences of the
stepzennamespace in theoperator.yamlfile with your custom namespace, replacing<my-namespace>with your own name:sed -i.orig 's/namespace: stepzen/namespace: <my-namespace>/g' operator.yaml - Create a namespace, and then set the context to the new namespace.
Run the following commands, replacing
Red Hat OpenShift:<my-namespace>with the name of your namespace (stepzenif you did not update the operator.yaml) file:
Kubernetes:oc new-project <my-namespace> oc project <my-namespace>kubectl create namespace <my-namespace> kubectl config set-context --current --namespace=<my-namespace>
- (Optional) Update the operator to define a custom namespace.
- Create the secrets.
The operator requires two secrets: an image pull secret of the type
kubernetes.io/dockerconfigjson, and the data source name (DSN) of your PostgreSQL database.- Create an image pull secret using your IBM entitlement
key.
Create an image pull secret named
ibm-entitlement-key(for OpenShift, replacekubectlwithoc):kubectl create secret docker-registry ibm-entitlement-key --docker-server=cp.icr.io --docker-username=cp --docker-password=<IBM entitlement key> - Create a generic secret for the PostgreSQL server.
Create a generic secret containing the key
DSNwith a DSN pointing to your PostgreSQL server (for OpenShift, replacekubectlwithoc):kubectl create secret generic db-secret --from-literal=DSN=<dsn>where
<dsn>is a string of the formpostgresql://user:password@host/database.
You can choose different secret names than those used in the examples. If you do, keep a record of the names and remember to use your own secrets when configuring the service).
- Create an image pull secret using your IBM entitlement
key.
- Download and extract the CASE bundle.
- Navigate to the
ibm-stepzen-casefolder:cd $HOME/.ibm-pak/data/cases/$CASE_NAME/$CASE_VERSION - Extract the CASE bundle by running the following
command:
tar zxvf ibm-stepzen-case--<$CASE_VERSION>.tgzThe contents are the CASE bundle are stored in a new directory called
ibm-stepzen-case.
- Navigate to the
- Apply the operator manifest files to your cluster.
- In the extracted CASE, navigate to the following directory, where the installation files are
stored:
ibm-stepzen-case/inventory/stepzenGraphOperator/files/deploy - In the
/deployfolder, locate the following files:crd.yamlis the operator Custom Resource Definition (CRD), a schema for the Custom Resource (CR) used to configure the operator.operator.yamldefines the operator resources, including the active service account and associated roles, webhook, and operator deployment configuration.
- Apply the files by running the following commands (for OpenShift, replace
kubectlwithoc):kubectl apply -f crd.yaml kubectl apply -f operator.yaml
- In the extracted CASE, navigate to the following directory, where the installation files are
stored:
- Create a custom
resource (CR) that defines the configuration settings for your deployment.
The
/deployfolder also contains a sample custom resource (CR) file namedcr.yaml. Modify the CR to customize your GraphQL server.At minimum, make the following changes to enable installation:
Tip: For information on settings, see CR configuration settings.- Accept the license agreement.
Review the API Connect for GraphQL License agreement, and then set the key
spec.licence.accepttotruein the CR file to indicate your agreement. - Add your registry access token.
Set
spec.imagePullSecretsto contain the name of the registry access token you created in step ii a. - Add your PostgreSQL secret.
Set
spec.controlDatabaseSecretto the name of the secret containing the PostgreSQL DSN (that is, containing aDSNkey), which you created in step ii b.The following snippet shows an example CR with minimal contents, which configures horizontal pod autoscaling (HPA) for the graph and graph subscription services:
apiVersion: stepzen-graph.ibm.com/v1beta1 kind: StepZenGraphServer metadata: name: stepzen spec: license: accept: true controlDatabaseSecret: db-secret imagePullSecrets: - ibm-entitlement-key graphServer: hpa: minReplicas: 1 maxReplicas: 10 targetCPUUtilizationPercentage: 80 graphServerSubscription: hpa: minReplicas: 1 maxReplicas: 5 targetCPUUtilizationPercentage: 80
For more information on the settings available in the CR, see Configuring API Connect for GraphQL Software.
- Accept the license agreement.
- Configure API Connect for GraphQL Software by
applying the CR.
- Apply the CR by running the following command (for OpenShift, replace
kubectlwithoc):kubectl apply -f cr.yaml - Verify that the operator is running (for OpenShift, replace
kubectlwithoc):kubectl get StepZenGraphServer
- Apply the CR by running the following command (for OpenShift, replace
When the installation completes successfully, you see a message similar to the following example, which indicates that the API Connect for GraphQL Software Graph Service is now running in your cluster:
NAME STATUS SUMMARY AGE stepzen Ready Services are ready 1mWhen you run
oc get pods, you see three types of pods running:stepzen-graph-operator-xxxx: Operator pod managing the servicestepzen-graph-server-xxxx: Graph Server handling single GraphQL requests (queries and mutations)stepzen-graph-server-subscription-xxxx: Graph Server handling GraphQL subscriptions (persistent queries)
- Create a namespace (project).
- Generate mirror manifests.
Troubleshoot the installation
If you see a message stating that the server doesn't have the resource type
StepZenGraphServer, then the operator installation failed and you should review
your cluster logs. If the operator pod is stuck in the ImagePullBackOff state,
review and correct your image pull secret.
Set up a route or an ingress
To expose the service to the internet, you must create a route (OpenShift) or an
ingress (Kubernetes).
Traffic must be routed to the NodePort object created by the operator, which
exposes the service on port 80 (HTTP). The routing object must also provide SSL termination to
expose the service over HTTPS.
-
OpenShift: Follow the instructions in Setting up a route in OpenShift Container Platform to use
Routeobjects that expose your service at the cluster domain (a URL ending withp1.openshiftapps.com/) usingcert-managerand self-signed or CA provided certificate. -
Kubernetes: Follow the instructions in Setting up an ingress in Kubernetes to set up an
Ingressobject with SSL.
- Setting up a route in OpenShift Container Platform
-
To set up a route, verify that you completed the following prerequisites:
- Operator installation completed successfully and pods are running.
- You have a cluster address of the form
my-rosa-cluster.abcd.p1.openshiftapps.com. - You installed cert-manager in your cluster.
- You can use a different CA (such as self-signed issuer) for your deployment.
- Install OpenShift Route Support for cert-manager
(
openshift-routes).OpenShift Route Support is an OpenShift add-on that supports annotation-based certificate assignment for OpenShift routes. For instructions, see the
openshift-routesdocumentation. Be sure to installopenshift-routesin the same namespace ascert-manager. - Set up a
stepzen-graph-serverroute for thestepzenaccount.This is the "root" account of the API Connect for GraphQL Software, which is used to host endpoints that modify the metadata database but does not serve application requests. The
stepzen-graph-serverroute is required for the API Connect for GraphQL Software CLI to function.- Create a file named
stepzen-route.yamlwith the following contents (replacemy-rosa-cluster.abcd.p1with your actual cluster domain:apiVersion: route.openshift.io/v1 kind: Route metadata: labels: route: stepzen-service name: stepzen-to-graph-server namespace: stepzen spec: host: stepzen.zen.apps.my-rosa-cluster.abcd.p1.openshiftapps.com port: targetPort: stepzen-graph-server tls: termination: edge insecureEdgeTerminationPolicy: None certificate: | -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- key: | -----BEGIN PRIVATE KEY----- [...] -----END PRIVATE KEY----- caCertificate: | -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- wildcardPolicy: None to: kind: Service name: stepzen-graph-server weight: 200 - Run the following command to apply the file, which installs the new route into the
cluster:
oc apply -f stepzen-route.yaml - To verify that the service is reachable, run the following
command:
curl https://stepzen.zen.apps.my-rosa-cluster.abcd.p1.openshiftapps.com/versionThe response is a JSON object containing a few fields with server build information (such as
GitSha).
- Create a file named
- Set up
stepzen-graph-serverandstepzen-graph-server-subscriptionsroutes for thegraphqlaccount.This is the default account for serving application requests.
- Create a file named
graphql-route.yamlwith the following contents (replacemy-rosa-cluster.abcd.p1with you actual cluster domain):apiVersion: route.openshift.io/v1 kind: Route metadata: labels: route: stepzen-service name: graphql-to-graph-server namespace: stepzen spec: host: graphql.zen.apps.my-rosa-cluster.abcd.p1.openshiftapps.com path: / port: targetPort: stepzen-graph-server tls: termination: edge insecureEdgeTerminationPolicy: None certificate: | -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- key: | -----BEGIN PRIVATE KEY----- [...] -----END PRIVATE KEY----- caCertificate: | -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- wildcardPolicy: None to: kind: Service name: stepzen-graph-server weight: 150 --- apiVersion: route.openshift.io/v1 kind: Route metadata: labels: route: stepzen-service name: graphql-to-graph-server-subscriptions namespace: stepzen spec: host: graphql.zen.apps.my-rosa-cluster.abcd.p1.openshiftapps.com path: /stepzen-subscriptions/ port: targetPort: stepzen-graph-server-subscription tls: termination: edge insecureEdgeTerminationPolicy: None certificate: | -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- key: | -----BEGIN PRIVATE KEY----- [...] -----END PRIVATE KEY----- caCertificate: | -----BEGIN CERTIFICATE----- [...] -----END CERTIFICATE----- wildcardPolicy: None to: kind: Service name: stepzen-graph-server-subscription weight: 150 - Run the following command to apply the
file:
oc apply -f graphql-route.yaml
Attention: For each account that you want to add to your deployment, you must add a new pair of routes mapping<account>.graphserver.apps.my-rosa-cluster.abcd.p1/and<account>.graphserver.apps.my-rosa-cluster.abcd.p1/stepzen-subscriptionsto thestepzen-graph-server. - Create a file named
- Setting up an ingress in Kubernetes
-
Note: The instructions in this section might not show the precise steps and commands needed for your deployment. The sequence of commands you need to run to expose the API Connect for GraphQL Graph Service through an ingress object depends on your DNS and SSL setup.
To set up an ingress, verify that you completed the following prerequisites:
- Operator installation completed successfully and pods are running.
- You obtained SSL certificates for the domains
stepzen.my-domain.ioandgraphql.my-domain.ioand stored them in secretsstepzen-certandgraphql-cert(alternatively, you can use a wildcard certificate for*.my-domain.ioin a single secret).
In the steps that follow, replace
my-domain.iowith the domain that you want to use.- Create the following ingress config file as
stepzen-ingress.yaml.
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: zenserv-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: defaultBackend: service: name: stepzen-graph-server port: number: 80 tls: - hosts: ['stepzen.my-domain.io'] secretName: stepzen-cert - hosts: ['graphql.my-domain.io'] secretName: graphql-cert rules: - host: stepzen.my-domain.io http: paths: - path: /stepzen-subscriptions/ pathType: Prefix backend: service: name: stepzen-graph-server-subscription port: number: 80 - host: graphql.my-domain.io http: paths: - path: /stepzen-subscriptions/ pathType: Prefix backend: service: name: stepzen-graph-server-subscription port: number: 80 - Apply the file with the following command to install the
ingress:
kubectl apply -f stepzen-ingress.yaml - Add the load balancer IP address and hostname in DNS.
Verify the installation
After the installation is complete, verify that you can reach the API Connect for GraphQL Graph Server:
Open a browser and navigate to
https://stepzen.<domain>/version
<domain> might be:- OpenShift: an OpenShift domain such as
graphserver.apps.my-rosa-cluster.abcd.p1 - Kubernetes: your own domain for which you have set up routing into the cluster and SSL termination
What to do next
- Install the optional on-premises Introspection Service, and
- Add user accounts