Installing the Tanzu SQL for Kubernetes Operator

Page last updated:

This topic describes how Kubernetes admins install, configure, and deploy the VMware Tanzu™ SQL with MySQL for Kubernetes Operator.

Overview

To install and configure Tanzu MySQL for Kubernetes, you must download resources and install the Tanzu MySQL for Kubernetes Operator using Helm.

To download resources and install the Operator:

  1. Download the Resources
  2. Install the Operator
    1. Create Namespace and Secret
    2. Review values.yaml and Create Overrides If Needed
    3. Use Helm CLI to Install the Operator

Prerequisites

Before you deploy the Tanzu MySQL for Kubernetes Operator, you need:

  • Access to VMware Tanzu Network and VMware Tanzu Network Registry. You can use the same credentials for both sites.

  • The Helm v3 command-line tool installed. For more information, see Installing Helm from the Helm documentation.

  • Docker running and configured on your local computer, to access the Kubernetes cluster and Docker registry. For information, see the Docker documentation.

  • A running Kubernetes cluster and the kubectl command-line tool, configured and authenticated to communicate with your Kubernetes cluster.

  • cluster-admin ClusterRole access to the Kubernetes cluster. For more information, see the Kubernetes documentation.

Download the Resources

To install the Tanzu MySQL for Kubernetes Operator, you must download the Helm chart, images, and deployment templates.

To download the resources:

  1. Set the environment variable to enable OCI support in the Helm v3 client by running:

    export HELM_EXPERIMENTAL_OCI=1
    

    If you skip this step, the following error message might appear:

    Error: this feature has been marked as experimental and is not enabled by default.

  2. Use Helm to log in to the Tanzu Network Registry by running:

    helm registry login registry.pivotal.io
    

    Follow the prompts to enter the email address and password for your VMware Tanzu Network account.

  3. Log in to VMware Tanzu Network and go to the VMware Tanzu™ SQL with MySQL for Kubernetes product page.

  4. Click Tanzu MySQL Deployment Templates to download the deployment templates to your local machine.

  5. Click Artifact References to navigate into the artifacts directory. Keep the page open to reference in the following step.

  6. Download each of the artifact references using the command line.

    1. To download tanzu-mysql-operator-chart to the Helm cache: Click the artifact from VMware Tanzu Network and paste the two commands into the command line.
      Modal shows 4 pieces of data: type, digest, 'set the environment variable' and 'pull this chart'


      For example:
      $ export HELM_EXPERIMENTAL_OCI=1
      $ helm chart pull registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart:1.0.0
      
      1.0.0: Pulling from registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart ref: registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart:1.0.0 digest: 2b6e1d010ab1737dcc5a426b223a06db1c616107d2ceaf368db6fda48d96a61a size: 4.2 KiB name: tanzu-sql-with-mysql-operator version: 1.0.0 Status: Downloaded newer chart for registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart:1.0.0
    2. To download tanzu-mysql-instance: Click the artifact from VMware Tanzu Network and paste the command into the command line.

      For example:
      $ docker pull registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-instance:1.0.0
      
      1.0.0: Pulling from tanzu-mysql-for-kubernetes/tanzu-mysql-instance f22ccc0b8772: Pull complete 3cf8fb62ba5f: Pull complete e80c964ece6a: Pull complete 0c31331fda89: Pull complete 0e9674cd2c60: Pull complete d88e035d5311: Pull complete 5055f7e93495: Pull complete 80e0c3183303: Pull complete 6312f33f1306: Pull complete 47733910cd21: Pull complete 4ac582ac7e82: Pull complete e9ad4cffabdc: Pull complete 4b9107ee1e3e: Pull complete faffd54990ce: Pull complete Digest: sha256:78073dcf626603da192b78643bda24e0098f944d0bd54da1d60924b20d5eea8c Status: Downloaded newer image for registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-instance:1.0.0 registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-instance:1.0.0
    3. To download the tanzu-mysql-operator image: Click the artifact from VMware Tanzu Network and paste the command into the command line.

      For example:
      $ docker pull registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator:1.0.0
      
      1.0.0: Pulling from tanzu-mysql-for-kubernetes/tanzu-mysql-operator be69922ffb42: Pull complete ef291e196a72: Pull complete Digest: sha256:91664f6866b7228b68d3fb9ff8e13af95f618b7b78e5fd35690dd29394a08db1 Status: Downloaded newer image for registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator:1.0.0 registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator:1.0.0

Install the Operator

To install the Tanzu MySQL for Kubernetes Operator, you must use kubectl to create a namespace and secret. Then, use the Helm CLI to install the Operator.

Create Namespace and Secret

To create the namespace and secret:

  1. Create the namespace by running:

    kubectl create namespace tanzu-mysql-for-kubernetes-system
    
  2. Set your kubectl context to the newly-created namespace by running:

    kubectl config set-context --current --namespace tanzu-mysql-for-kubernetes-system
    
  3. If you want to deploy the Tanzu MySQL for Kubernetes images from a registry other than registry.pivotal.io, log in to the docker registry:

    docker login -u DOCKER-USERNAME -p DOCKER-PASSWORD registry.pivotal.io
    
  4. Create a Kubernetes secret for accessing registry containing the Tanzu MySQL for Kubernetes images by running:

    kubectl create secret docker-registry tanzu-mysql-image-registry --docker-server=https://registry.pivotal.io/ \
    --docker-username=DOCKER-USERNAME --docker-password=DOCKER-PASSWORD
    
  5. Download the Helm chart to your current working directory on your local machine by running:

    helm chart export REGISTRY-URL
    

    Where REGISTRY-URL is the reference to the Tanzu MySQL for Kubernetes Helm chart.


    The value of REGISTRY-URL has the following pattern:

    registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart:VERSION-NUMBER-TAG
    

    Where VERSION-NUMBER-TAG is the version of the Helm chart.


    This downloads a directory named tanzu-sql-with-mysql-operator/ into your current working directory that contains:

    • The Tanzu MySQL for Kubernetes Helm chart
    • Custom Resource Definitions (CRDs)
    • Role-Based Access Control (RBAC) definitions required to install the Operator with Helm


    For example:

    $ helm chart export registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart:1.0.0
    
    ref: registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator-chart:1.0.0 digest: 2b6e1d010ab1737dcc5a426b223a06db1c616107d2ceaf368db6fda48d96a61a size: 4.2 KiB name: tanzu-sql-with-mysql-operator version: 1.0.0 Exported chart to tanzu-sql-with-mysql-operator/

Review values.yaml and Create Overrides If Needed

In most situtations, the default values supplied in the values.yaml file do not need to be changed.

However, if any of the following are true, you need to follow the steps below to override the defaults:

  • You deployed the Tanzu SQL for Kubernetes images from a registry other than registry.pivotal.io.
  • You did not use the default tanzu-mysql-image-registry for the secret name in Step 4 above.
  • You want to allocate different CPU or memory resources for your Operator.

Note: Do not edit values.yaml directly. Create a values-override.yaml.

Confirm and configure the Tanzu SQL Operator for your environment:

  1. Review the values.yaml file.

    For example:

    ---
    imagePullSecret: tanzu-mysql-image-registry
    
    operatorImage: registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-operator:1.0.0
    instanceImage: registry.pivotal.io/tanzu-mysql-for-kubernetes/tanzu-mysql-instance:1.0.0
    resources: limits: cpu: 100m memory: 128Mi requests: cpu: 100m memory: 128Mi

  2. Determine which values in the values.yaml file need to be changed for your environment. Use the table below as a guide.

    Key Value Type Description
    imagePullSecret String Name of image secret. This value must match the name of the Kubernetes secret you create in Create Namespace and Secret above.
    operatorImage URI Reference to the Tanzu MySQL for Kubernetes Operator image. If you uploaded the Operator image to a private registry, you must change this reference to pull the Operator image from your registry.
    instanceImage URI Reference to the Tanzu MySQL for Kubernetes image. If you have uploaded the Tanzu MySQL for Kubernetes image to a private registry, you change this reference to pull the Tanzu MySQL for Kubernetes image from your registry.
    resources List Limits and requests for CPU and memory for the Tanzu MySQL for Kubernetes Operator. You can change these values to scale your resources.

  3. Create a copy of values.yaml and name the new filevalues-override.yaml.

  4. Edit the values that you want to change.

  5. Delete the sections of the file that you do not change.

  6. Save the values-override.yaml file in the same directory as the values.yaml file.

Use Helm CLI to Install the Operator

To install the Operator using the Helm CLI:

  1. Verify that you are in the same working directory as where you downloaded the Helm chart in Step 4 of Create Namespace and Secret above.

  2. Install the Tanzu MySQL for Kubernetes Operator by running one of the following:

    • If you created a custom values-override.yaml in Review values.yaml and Create Overrides If Needed above, then run the following helm command:

      helm install --values=/your/values-override.yaml tanzu-sql-with-mysql-operator ./tanzu-sql-with-mysql-operator/
      
    • If you did not create a values-override.yaml, then run the following helm command:

      helm install tanzu-sql-with-mysql-operator ./tanzu-sql-with-mysql-operator/
      
  3. See that your Operator has installed successfully by running:

    kubectl get all
    

    The Tanzu MySQL for Kubernetes Operator has finished installing when you see the value of the STATUS column for the Tanzu MySQL for Kubernetes Operator Pod is Running. See example output:

    $ kubectl get all
    NAME                                                           READY   STATUS    RESTARTS   AGE
    pod/mysql-for-kubernetes-controller-manager-84d76dfb77-lq5mb   1/1     Running   0          21s
    
    NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/mysql-for-kubernetes-controller-manager 1/1 1 1 23s
    NAME DESIRED CURRENT READY AGE replicaset.apps/mysql-for-kubernetes-controller-manager-84d76dfb77 1 1 1 23s

    Note: You can only have one Tanzu MySQL for Kubernetes Operator installed in a Kubernetes cluster.