sidebar_label |
---|
Quick Start Guide for Google Cloud Platform GKE |
Before you begin, you need to have a Google Cloud account, a project and install the following tools:
- kubectl 1.28 or later
- Helm 3.11 or later
- google-cloud-cli
- gke-gcloud-auth-plugin
:::note
For some operation systems we recommend install google-cloud-sdk
package instead of google-cloud-cli
.
:::
Perform initial setup tasks and set up your default project:
gcloud init
Set up environment variables:
export LOCATION=us-central1
export PROJECT_ID={your_project_id}
export CLUSTER_NAME={reportportal_cluster_name}
export REPO_NAME={reportportal_helm_repo_name}
export RELEASE_NAME={reportportal_release_name}
export VERSION={current_chart_version}
export SUPERADMIN_PASSWORD={your_superadmin_password}
:::note
Here and below we use us-central1
region as a location for GKE cluster.
However, you can use any other region.
:::
If you have Docker, you can use the Docker credential helper to authenticate to Artifact Registry.
Just perform the following commands:
gcloud auth login
gcloud auth configure-docker ${LOCATION}-docker.pkg.dev
Find more information about gcloud credential helper.
Installation of ReportPortal requires setting up access to your GKE cluster for creating a service account in GKE and providing permissions for some services to access Kubernetes API.
For adjusting access, you can do it using both Identity and Access Management (IAM) and Kubernetes RBAC.
You can use Predefined GKE Roles and update your account role. To set a service account on nodes, you must also have the Service Account User role (roles/iam.serviceAccountUser).
:::important We recommend to create a separate IAM Service Account for working with GKE cluster. :::
:::important All GKE clusters are created as public clusters by default. :::
You can create two types of GKE clusters:
:::note
We recommend to use Autopilot mode.
It is a managed Kubernetes environment that reduces the operational cost.
:::
It's pretty simple to create a cluster in Autopilot mode:
gcloud container clusters create-auto ${CLUSTER_NAME} \
--location=${LOCATION}
More information about creating a cluster in Autopilot mode.
For a standard cluster you need to specify a machine type and a number of nodes.
ReportPortal requires at least 3 nodes with 2 vCPU and 4 GB memory for each.
We recommend using e2-standard-2
machine type with 2 vCPU and 8 GB memory:
export MACHINE_TYPE=e2-standard-2
gcloud container clusters create ${CLUSTER_NAME} \
--zone=${LOCATION} \
--machine-type=${MACHINE_TYPE} \
--num-nodes=3
More information about creating a cluster in Standard mode.
gcloud container clusters get-credentials ${CLUSTER_NAME} \
--location=${LOCATION}
You can verify the cluster:
gcloud container clusters describe ${CLUSTER_NAME} \
--location=${LOCATION}
At the current moment, you can install ReportPortal on GKE cluster via Helm chart only from develop branch.
Create a repository in Artifact Registry for ReportPortal Helm charts:
gcloud artifacts repositories create ${REPO_NAME} --repository-format=docker \
--location=${LOCATION} --description="ReportPortal Helm repository"
More information about Store Helm charts in the Artifact Registry.
Verify that the repository was created:
gcloud artifacts repositories list
gcloud auth print-access-token | helm registry login -u oauth2accesstoken \
--password-stdin https://${LOCATION}-docker.pkg.dev
Add GitHub repository on your local machine:
git clone https://github.com/reportportal/kubernetes.git
Build and push the Helm chart to Artifact Registry using actual helm chart version and your project id:
cd kubernetes/reportportal
helm dependency update
helm package .
helm push reportportal-${VERSION}.tgz oci://${LOCATION}-docker.pkg.dev/${PROJECT_ID}/${REPO_NAME}
By default, ReportPortal Helm chart install with infrastructure dependencies in GKE Autopilot Cluster:
- PostgreSQL
- OpenSearch
- RabbitMQ
- MinIO
You can disable an installation of some components via Helm chart values, but you have to provide new credentials for your standalone components.
More information about it you can find here: Install the chart with dependencies.
For installing ReportPortal on GKE Autopilot Cluster, you need to set the:
- ingress controller as a
gce
- superadmin password
- resources requests for api, uat, and analyzer services
helm install \
--set ingress.class="gce" \
--set uat.superadminInitPasswd.password=${SUPERADMIN_PASSWORD} \
--set uat.resources.requests.memory="1Gi" \
--set serviceapi.resources.requests.cpu="1000m" \
--set serviceapi.resources.requests.memory="2Gi" \
--set serviceanalyzer.resources.requests.memory="1Gi" \
${RELEASE_NAME} \
oci://${LOCATION}-docker.pkg.dev/${PROJECT_ID}/${REPO_NAME}/reportportal \
--version ${VERSION}
For installing ReportPortal on GKE Standard Cluster you need to set:
- ingress controller as a
gce
- superadmin password
helm install \
--set ingress.class="gce" \
--set uat.superadminInitPasswd.password=${SUPERADMIN_PASSWORD} \
${RELEASE_NAME} \
oci://${LOCATION}-docker.pkg.dev/${PROJECT_ID}/${REPO_NAME}/reportportal \
--version ${VERSION}
You can add custom gce ingress annotations via ingress.annotations.gce
parameter:
helm install \
...
--set-json='ingress.annotations.gce={"key1":"value1","key2":"value2"}'
...
If you have some domain name, set this FQDN to ingress.hosts
:
helm install \
...
--set ingress.hosts[0].reportportal.k8.com
...
:::note This is recommended approach for using SSL certificates in GKE. :::
You can use Google-managed SSL certificates for your domain name:
helm install \
...
--set ingress.tls.certificate.gcpManaged=true
--set ingress.hosts\[0\]="example.com"
...
You can use Cert-Manager to manage certificates for your domain name.
To delete the cluster:
gcloud container clusters delete ${CLUSTER_NAME} --location=${LOCATION}
To delete the artifacts repository:
gcloud artifacts repositories delete ${CLUSTER_NAME} --location=${LOCATION}
If you want to disable HTTP Load Balancing, you can do it after the certificate is attached to the Ingress resource:
kubectl annotate ingress ${APP_NAME}-gateway-ingress kubernetes.io/ingress.allow-http: "false"