Deploying CData Sync in a Kubernetes Environment

CData Sync provides automated, continuous replication of your enterprise data to any data store.

Containerization technology enables you to create applications rapidly and securely and to deploy your application containers to any infrastructure. However, manually installing and managing each container in your system can be time-consuming, error prone, and resource intensive. To avoid these issues, you need a tool that automates the processes for deployment, scaling, and managing your containerized applications.

Kubernetes, a popular open-source platform built on fifteen years of container-management experience at Google, solves those issues by automating and managing all processes that are involved in deployment and scaling of containerized applications. By deploying CData Sync in a Kubernetes environment, you can take advantage of Kubernetes’ orchestration functionality, including high availability (no downtime), scalability of loads, and backup-and-restore capabilities.

This article provides step-by-step instructions for deploying Sync in the Kubernetes environment, and it lists the tools that you need for that process.


The following tools are required in order to deploy Sync in Kubernetes:

Deploying CData Sync in a Kubernetes Environment

The basic steps for deploying Sync in Kubernetes are as follows:

  1. Gather resources and build a Docker image.
  2. Build a Docker container.
  3. Deploy the container to Kubernetes.

Each of these main steps are broken into multiple steps in the following sections:

Step 1: Gather Resources and Build a Docker Image

  1. Create a new folder locally. Include the following items in this folder:
    • sync.jar file
    • file
    • webapp folder (which contains the sync.war file)
    The files, along with the webapp folder, are installed with Sync, as shown in this example folder structure:
  2. Create a file named Dockerfile in the same folder that you created in Step 1. Include the following content in that file:
    # copy required files and fix permissions
    RUN mkdir -p /opt/sync/webapp
    WORKDIR /opt/sync/
    COPY sync.jar sync.jar
    COPY webapp/sync.war webapp/sync.war
    COPY /opt/sync/
    RUN addgroup --system --gid 20000 cdatasync \
        && adduser --system --uid 20000 --gid 20000 cdatasync \
        && mkdir -p /var/opt/sync \
        && chown -R cdatasync:cdatasync /var/opt/sync \
        && chown -R cdatasync:cdatasync /opt/sync
    # change user and set environment
    USER cdatasync
    ENV APP_DIRECTORY=/var/opt/sync
    EXPOSE 8181
    # run the app
    CMD ["java","-jar","sync.jar"]
  3. Create a database server to use as the application database (ApplicationDatabase).
    1. Create a database (for example, a PostgreSQL database) in Azure:
      az postgres server create --resource-group ResourceGroup --name ServerName
      The output from this command are your credentials.
    2. Add the credentials to the configuration that is in the file, as shown below. (The file resides in InstallationDirectory.);Database=DatabaseName;User=UserName;Password=Password;UseSSL=True;UseConnectionPooling=True;
  4. Create an Azure volume for ApplicationDirectory.
    1. Create the volume:
      az storage account create --name AccountName --resource-group ResourceGroup --kind FileStorage --sku Premium_LRS
      Note: For better performance, the Premium storage type is recommended for locally redundant storage.
    2. Retrieve the account keys and save these keys for use in later steps:
      az storage account keys list --account-name AccountName
    3. Create a file share on the storage account:
      az storage share-rm create --resource-group ResourceGroup --storage-account AccountName --name ShareName --quota 100

Step 2: Build a Docker Container

  1. Navigate in the shell (if you are not already there) to the local folder that you created earlier.
  2. Build the Docker container.
    docker build . -t sync
  3. Run the container.
    docker run -p 80:8181 -d sync
  4. Confirm that your image is running by opening your browser to http://localhost.

Step 3: Deploy the Docker Container to Kubernetes

  1. Create Kubernetes services on Azure
  2. Login to your Azure account from a Microsoft Windows PowerShell. You should have the Azure CLI installed already.
    az login
  3. Navigate to your resource group in the Azure Kubernetes Service and locate the container registry. You need this registry to retrieve the login server.
    1. In your Azure Kubernetes Service, navigate to your resource group.
    2. Locate the container registry that is inside the resource group.
    3. The login server is available inside the container registry, as shown below:
  4. Login to the container registry by using your username, password, and login server. (Note: The use of a username and password is optional.)
    az acr login --name LoginServerName --username YourUserName --password YourPassword
  5. Add a tag in the container registry by submitting these statements
    docker tag image_name LoginServerName name:value
                    docker push LoginServerName/name:value
  6. Navigate to the Kubernetes Service in Azure and click Connect. Then, Azure displays the commands that must be run in order to connect to the cluster and apply changes.
  7. Validate the nodes by submitting this command:
    kubectl get nodes
  8. Create a manifest file of type YAML. Name the file sync.yaml. An example of this file is shown below.
    apiVersion: apps/v1
    kind: Deployment
            name: cdata-http
        name: cdata-http
        replicas: 1
                name: cdata-http
                    name: cdata-http
                -   name: cdata-http
                    imagePullPolicy: Always
        -   name: http
            containerPort: 8181
            protocol: TCP
    apiVersion: v1
    kind: Service
        name: service-http
            name: cdata-http
        -   protocol: TCP
            port: 80
            targetPort: 8181
        type: LoadBalancer
  9. Deploy this YAML file to the cluster.
    kubectl apply -f sync.yaml
  10. Retrieve the external IP address for the service.
    kubectl get all

With these steps completed, you should be able to connect to Sync at http://External-IP.

Free Trial & More Information

Now that you have seen how to deploy Sync in the Kubernetes environment, visit our CData Sync page to read more information about CData Sync and download a free trial. Start consolidating your enterprise data to a cloud data warehouse today! As always, our world-class Support Team is ready to answer any questions you may have.