DataSunrise - Deployment - On - Azure - With - Kubernetes - and - Docker
DataSunrise - Deployment - On - Azure - With - Kubernetes - and - Docker
DataSunrise - Deployment - On - Azure - With - Kubernetes - and - Docker
In a Microsoft Azure
Kubernetes Cluster
Instruction Manual
September, 2022
Оглавление
1. Introduction..........................................................................................................................................3
Prerequisites ........................................................................................................................................3
2. Getting DataSunrise Docker Image ......................................................................................................3
3. Creating a Container Registry...............................................................................................................4
4. Creating a New Kubernetes Cluster .....................................................................................................6
5. Enabling AKS-managed Azure AD Integration on the cluster ..............................................................7
6. Running DataSunrise ............................................................................................................................7
7. Protecting an Azure SQL Database Instance ..................................................................................... 11
8. Updating DataSunrise........................................................................................................................ 14
9. Common Issues and Troubleshooting ............................................................................................... 15
1. Introduction
This document describes the process of deployment and configuring of DataSunrise
Database Security in a Microsoft Azure Kubernetes cluster.
Prerequisites
You need a Linux system to prepare your Kubernetes cluster on Azure. In order to deploy
DataSunrise with Azure Kubernetes service, the following components should be installed:
⚫ Docker
⚫ Azure CLI
⚫ Kubernetes CLI
If you have the Debian 10 Linux OS, install required packages to prepare your system:
• Docker CE:
sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/debian $(lsb_release -cs)
stable"
curl -fsSL https://download.docker.com/linux/debian/gpg |
sudo apt-key add -
sudo apt update
sudo apt install apt-transport-https ca-certificates curl
gnupg2 software-properties-common
sudo apt install docker-ce
If you have another type of Linux, prepare the system to meet the requirements listed
above.
https://hub.docker.com/r/datasunrise/datasunrise
2.1 Having met all the requirements, use the following command on Debian-based Linux:
3.2 Make sure you have set the default subscription in your Azure account. Create a new
Resource Group using the az group create command, but you can use an existing
Resource Group as well:
Example:
az group create --name myResourceGroup --location eastus
3.3 Create an instance of the Azure Container Registry instance (ACR) using the az acr
create command and enter your own registry name:
In case you need to use a login token, get the token to use with Docker:
az acr login -n [AZURE CONTAINER REGISTRY NAME] --expose-token
3.4 Now we need to tag the container image with the address of the registry login server.
But first we should get the address of the login server (ACRServerName). To do this, we use
the az acr list command and query the loginServer as shown below:
az acr list -g [YOUR RESOURCE GROUP NAME] --query
"[].{ACRServerName:loginServer}" --output table
For example, if you use “myResourceGroup” as the name of your Resource Group:
az acr list -g myResourceGroup --query
"[].{ACRServerName:loginServer}" --output table
3.5 Now let’s tag the local DataSunrise Docker image using the ACRServerName address of
the Container Registry. For example, if the release number of DataSunrise downloaded using
Docker is “7.2.10.19061”, use the following command:
docker tag datasunrise/datasunrise:7.2.10.19061 [YOUR
ACRServerName]/datasunrise:7.2.10.19061
To verify that the tags have been applied, run the docker image ls command again:
$ sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
myResourceGroup.azurecr.io/datasunrise 7.2.10.19061 b4d7c8e04576
5 days ago 3.35GB
datasunrise/datasunrise latest b4d7c8e04576 5 days ago
3.35GB
3.6 Once we have the image created and tagged, we can push it to the ACR instance:
Run the az acr repository list command to list the images pushed to the ACR
instance:
az acr repository list -n [AZURE CONTAINER REGISTRY NAME]
For example, if your ACR name is ”ACRDatasunrise”, the output will be as follows:
az aks create \
-g [YOUR RESOURCE GROUP NAME] \
-n [YOUR NEW CLUSTER NAME] \
--node-count 2 \
--generate-ssh-keys \
--attach-acr [AZURE CONTAINER REGISTRY NAME]
4.2 Use the kubectl tool (Kubernetes command line client) to connect to your Kubernetes
cluster from your local machine. Make sure the Kubernetes command line interface is
installed. To configure kubectl to connect to your Kubernetes cluster, use az aks get-
credentials:
az aks get-credentials -g [YOUR RESOURCE GROUP NAME] -n [YOUR NEW
CLUSTER NAME]
To test connectivity with the cluster, use the kubectl get nodes command to get a list
of the cluster nodes:
kubectl get nodes
If an AKS-managed Azure AD cluster is activated, the following section in the response body
should be displayed:
"AADProfile": {
"adminGroupObjectIds": [
"5d24****-****-****-****-****afa27aed"
],
"clientAppId": null,
"managed": true,
"serverAppId": null,
"serverAppSecret": null,
"tenantId": "72f9****-****-****-****-****d011db47"
}
5.2 Execute the following command and follow the instructions to sign in to your cluster
again:
6. Running DataSunrise
To implement DataSunrise Service to Kubernetes cluster, a .yaml file with the objects that
are to be deployed should be configured.
6.1 Create two .yaml files locally on your machine (datasunrise.yml and datasunrise-lb.yml).
Put the strings listed below into your datasunrise.yml file.
Replace myResourceGroup.azurecr.io with your ACR service name, and replace 7.2.10.19061
with your DataSunrise release number.
apiVersion: v1
kind: Pod
metadata:
name: datasunrise-test
labels:
app: web
spec:
containers:
- name: datasunrise
image: myResourceGroup.azurecr.io/datasunrise:7.2.10.19061
ports:
- containerPort: 11000
To deploy an AKS cluster on remote configuration, add the following environment variables
to the containers section of the .yaml file:
containers:
- name: datasunrise
env:
- name: 'DICTIONARY_TYPE'
value: ''
- name: 'DICTIONARY_HOST'
value: ''
- name: 'DICTIONARY_PORT'
value: ''
- name: 'DICTIONARY_DB_NAME'
value: ''
- name: 'DICTIONARY_LOGIN'
value: ''
- name: 'DICTIONARY_PASS'
value: ''
- name: 'AUDIT_TYPE'
value: ''
- name: 'AUDIT_HOST'
value: ''
- name: 'AUDIT_PORT'
value: ''
- name: 'AUDIT_DB_NAME'
value: ''
- name: 'AUDIT_LOGIN'
value: ''
- name: 'AUDIT_PASS'
value: ''
6.3 To deploy the application, use the kubectl apply command (we assume that our
new .yml files are placed in the current folder):
kubectl apply -f datasunrise.yaml
kubectl apply -f datasunrise-lb.yaml
6.4 DataSunrise Kubernetes container with two nodes (pods) and a Load Balancer have been
created to provide access to the cluster outside the cluster subnets. For access to
DataSunrise Web Console, use your Load Balancer’s public IP address:
6.5 You can also monitor all the resources that were created via the Azure Portal. Navigate
to your Resource Group:
7.1 Log into your Azure account you used on the Linux system, then navigate to your Azure
SQL Server at the Azure portal. Add an existing Virtual Network to provide access to your
Database Instance.
7.2 Add SQL Database Instance to DataSunrise. See DataSunrise User Guide, section
“Configuring an MS SQL Server Connection” to meet the requirements for database login.
Otherwise, you can use the Azure Active Directory authentication method for database login.
Input the required parameters (see the instructions below):
• Logical Name: profile's logical name (it is used by DataSunrise as a reference to the
database)
Then check the Use Custom Connection String check box and paste the string into the
corresponding field:
Click Test. If a connection has been successfully established, scroll down and click Save:
When your DataSunrise cluster built with Kubernetes and Docker is up and running on
Microsoft Azure, you can configure DataSunrise Rules to audit, secure or mask your sensitive
database columns. See section “DataSunrise Use Cases” of the DataSunrise User Guide:
https://www.datasunrise.com/documents/DataSunrise_Database_Security_Suite_User_Guide.pdf
8. Updating DataSunrise
To change the version of DataSunrise, do the following:
8.1 Pull the Docker image of the newer version to your local repository: use Docker UI in
case if you are using Docker Desktop on Windows.
If you are using Docker on Linux, you can use the following command:
8.2 Tag the Docker image using the address of your ACR:
docker tag datasunrise/datasunrise:latest
acrname.azurecr.io/datasunrise:latest
8.5 Edit your .yaml file: change the name of pods (containers) and edit the lines with the
images of DataSunrise.
8.6 Start the new Deployment using the edited .yaml file:
kubectl apply -f filename.yaml
9.1 You may face the following error in the logs after you started a Deployment:
This error usually occurs if the names of the pods were not changed in the new Deployment
(in case if DataSunrise was not installed during the first Deployment and you decided to start
a new one). The error happens because Dictionary database already reserved the names of
pods in itself and you cannot create a new Deployment with the same names.
You may receive an “unauthorized: authentication required” error when pushing your Image
to your ACR or pushing a new image to your ACR in place of an existing one. One of the ways
to resolve this issue:
If you are using Docker Desktop, you need to pull the image to your local repository before
pushing it to ACR.
Note: if you use “az acr login -n azureacrname –expose-token” you can receive an
“unauthorized: authentication required” error again after pushing attempt. This may happen
because your expose token in ACR expired.