Migrate OpenSearch management to Nais Console ¶
This guide will help you migrate an existing OpenSearch instance to instead be managed via Nais Console.
Prerequisites ¶
Before we begin, ensure that:
- You're part of a Nais team
- You have set up command-line access
- You have an existing OpenSearch instance
Steps ¶
1. Verify that your existing OpenSearch settings are compatible with Console ¶
Before migrating, ensure that your existing OpenSearch instance is compatible with Nais Console.
Console currently supports the following fields:
-
.spec.plan- plan is now split into memory and tier-
memorydenotes the memory size of the instance -
tierdenotes the availability tier of the instance-
SINGLE_NODE(equivalent tostartup-*, orhobbyistfor the smallestmemory) -
HIGH_AVAILABILITY(equivalent tobusiness-*)
-
- For example, if your existing plan is
startup-4, you would set:-
memory = "GB_4" -
tier = "SINGLE_NODE"
-
- If your existing plan is
business-16, you would set:-
memory = "GB_16" -
tier = "HIGH_AVAILABILITY"
-
- If your existing plan is
hobbyist, you would set:-
memory = "GB_2" -
tier = "SINGLE_NODE"
-
-
-
.spec.disk_space -
.spec.userConfig.opensearch_version -
.spec.project(automatically set) -
.spec.terminationProtection(automatically enabled)
If you need other fields not supported by Console, reach out to the Nais team.
2. Delete OpenSearch manifest from your Git repository ¶
Your Git repository might have a manifest file that was used to create the OpenSearch instance. It should look something like this:
-apiVersion: aiven.io/v1alpha1
-kind: OpenSearch
-metadata:
- labels:
- app: opensearch-tester
- team: myteam
- name: opensearch-myteam-tester
- namespace: myteam
-spec:
- plan: startup-4
- project: nav-devDelete the file from your repository.
If you have configured a ServiceIntegration for the OpenSearch instance, you should also remove that manifest file from your repository. It should look something like this:
-apiVersion: aiven.io/v1alpha1
-kind: ServiceIntegration
-metadata:
- labels:
- team: <TEAM>
- name: opensearch-<TEAM>-<INSTANCE>
- namespace: <TEAM>
-spec:
- project: miljodir-<ENV>
- integrationType: prometheus
- destinationEndpointId: <ENDPONT-ID>
- sourceServiceName: opensearch-<TEAM>-<INSTANCE>3. Remove references from GitHub Actions workflows ¶
If you have any GitHub Actions workflows that references the OpenSearch manifest file you just deleted, you should remove those references.
If you are using the Nais CLI (nais apply), simply remove the apply command for the OpenSearch manifest.
If you are still using the legacy nais/deploy action, remove the OpenSearch file from the RESOURCE list:
name: Build and deploy
on: [...]
jobs:
build-and-deploy:
...
steps:
...
- uses: nais/deploy/actions/deploy@v2
env:
- RESOURCE: .nais/app.yaml,.nais/opensearch.yaml
+ RESOURCE: .nais/app.yaml
...
``If you had a ServiceIntegration manifest file, remove references to that as well.
4. Patch resource in Kubernetes ¶
To allow Console to take over management of the OpenSearch instance, you need to add a label to the existing OpenSearch resource in your Kubernetes cluster.
To do so, run the following command:
export OPENSEARCH_NAME="<OPENSEARCH-NAME">
export TEAM="<TEAM>"
export ENVIRONMENT="<ENVIRONMENT>"
kubectl label opensearch $OPENSEARCH_NAME nais.io/managed-by=console \
--namespace $TEAM \
--context $ENVIRONMENTwhere
-
$OPENSEARCH_NAMEis the fully qualified name of your OpenSearch instance, e.g.opensearch-<TEAM>-<INSTANCE>. -
$TEAMis your team. -
$ENVIRONMENTis the name of the environment you're targeting.
5. Finishing up ¶
- Visit Nais Console.
- Navigate to your team.
- Navigate to the OpenSearch overview in the sidebar.
- Verify that you can see the OpenSearch instance without the prefix
opensearch-<TEAM>-in its name. - Click the OpenSearch instance to view its details.
- Verify that you can Edit or Delete the OpenSearch instance.
Congratulations! You've now successfully migrated your OpenSearch instance to be managed via Nais Console.