From 9cdb147ce9db529c1f3b425173775f920c6c33f2 Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Thu, 14 Nov 2019 14:27:46 -0800 Subject: [PATCH 01/10] Adding Azure Arc Data Controller scripts. --- .../azure-arc-data-controller/README.md | 59 +++ .../deployment/README.md | 16 + .../deployment/aks/README.md | 49 +++ .../deployment/aks/deploy-controller-aks.py | 102 +++++ .../deployment/kubeadm/README.md | 14 + .../kubeadm/ubuntu-single-node-vm/README.md | 53 +++ .../cleanup-controller.sh | 87 +++++ .../ubuntu-single-node-vm/setup-controller.sh | 350 ++++++++++++++++++ .../deployment/kubeadm/ubuntu/README.md | 31 ++ .../ubuntu/local-storage-provisioner.yaml | 129 +++++++ .../deployment/kubeadm/ubuntu/rbac.yaml | 12 + 11 files changed, 902 insertions(+) create mode 100644 samples/features/azure-arc-data-controller/README.md create mode 100644 samples/features/azure-arc-data-controller/deployment/README.md create mode 100644 samples/features/azure-arc-data-controller/deployment/aks/README.md create mode 100644 samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/README.md create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml create mode 100644 samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml diff --git a/samples/features/azure-arc-data-controller/README.md b/samples/features/azure-arc-data-controller/README.md new file mode 100644 index 00000000..8a68db32 --- /dev/null +++ b/samples/features/azure-arc-data-controller/README.md @@ -0,0 +1,59 @@ +# Azure Arc Data Controller clusters + +Installation instructions for SQL Server 2019 big data clusters can be found [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sql-server-ver15). + +## Samples Setup + +**Before you begin**, load the sample data into your big data cluster. For instructions, see [Load sample data into a SQL Server 2019 big data cluster](https://docs.microsoft.com/en-us/sql/big-data-cluster/tutorial-load-sample-data). + +## Executing the sample scripts +The scripts should be executed in a specific order to test the various features. Execute the scripts from each folder in below order: + +1. __[spark/data-loading/transform-csv-files.ipynb](spark/data-loading/transform-csv-files.ipynb)__ +1. __[data-virtualization/generic-odbc](data-virtualization/generic-odbc)__ +1. __[data-virtualization/hadoop](data-virtualization/hadoop)__ +1. __[data-virtualization/storage-pool](data-virtualization/storage-pool)__ +1. __[data-virtualization/oracle](data-virtualization/oracle)__ +1. __[data-pool](data-pool/)__ +1. __[machine-learning/sql/r](machine-learning/sql/r)__ +1. __[machine-learning/sql/python](machine-learning/sql/python)__ + +## __[data-pool](data-pool/)__ + +SQL Server 2019 big data cluster contains a data pool which consists of many SQL Server instances to store data & query in a scale-out manner. + +### Data ingestion using Spark +The sample script [data-pool/data-ingestion-spark.sql](data-pool/data-ingestion-spark.sql) shows how to perform data ingestion from Spark into data pool table(s). + +### Data ingestion using sql +The sample script [data-pool/data-ingestion-sql.sql](data-pool/data-ingestion-sql.sql) shows how to perform data ingestion from T-SQL into data pool table(s). + +## __[data-virtualization](data-virtualization/)__ + +SQL Server 2019 or SQL Server 2019 big data cluster can use PolyBase external tables to connect to other data sources. + +### External table over Generic ODBC data source +The [data-virtualization/generic-odbc](data-virtualization/generic-odbc) folder contains samples that demonstrate how to query data in MySQL & PostgreSQL using external tables and generic ODBC data source. The generic ODBC data soruce can be used only in SQL Server 2019 on Windows. + +### External table over Hadoop +The [data-virtualization/hadoop](data-virtualization/hadoop) folder contains samples that demonstrate how to query data in HDFS using external tables. This demonstrates the functionality available from SQL Server 2016 using the HADOOP data source. + +### External table over Oracle +The [data-virtualization/oracle](data-virtualization/oracle) folder contains samples that demonstrate how to query data in Oracle using external tables. + +### External table over Storage Pool +SQL Server 2019 big data cluster contains a storage pool consisting of HDFS, Spark and SQL Server instances. The [data-virtualization/storage-pool](data-virtualization/storage-pool) folder contains samples that demonstrate how to query data in HDFS inside SQL Server 2019 big data cluster. + +## __[deployment](deployment/)__ + +The [deployment](deployment) folder contains the scripts for deploying a Kubernetes cluster for SQL Server 2019 big data cluster. + +## __[machine-learning](machine-learning/)__ + +SQL Server 2016 added support executing R scripts from T-SQL. SQL Server 2017 added support for executing Python scripts from T-SQL. SQL Server 2019 adds support for executing Java code from T-SQL. SQL Server 2019 big data cluster adds support for executing Spark code inside the big data cluster. + +### SQL Server Machine Learning Services +The [machine-learning\sql](machine-learning\sql) folder contains the sample SQL scripts that show how to invoke R, Python, and Java code from T-SQL. + +### Spark Machine Learning +The [machine-learning\spark](machine-learning\spark) folder contains the Spark samples. diff --git a/samples/features/azure-arc-data-controller/deployment/README.md b/samples/features/azure-arc-data-controller/deployment/README.md new file mode 100644 index 00000000..fe5ec277 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/README.md @@ -0,0 +1,16 @@ + +# Creating a Kubernetes cluster for SQL Server 2019 big data cluster + +SQL Server 2019 big data cluster is deployed as docker containers on a Kubernetes cluster. These samples provide scripts that can be used to provision a Kubernetes clusters using different environments. + +## __[Deploy a Kubernetes cluster using kubeadm](kubeadm/)__ + +Use the scripts in the **kubeadm** folder to deploy a Kubernetes cluster over one or more Linux machines (physical or virtualized) using `kubeadm` utility. + +## __[Deploy a SQL Server big data cluster on Azure Kubernetes Service (AKS)](aks/)__ + +Using the sample Python script in **aks** folder, you will deploy a Kubernetes cluster in Azure using AKS and a SQL Server big data cluster using on top of it. + +## __[Push SQL Server big data cluster images to your own private Docker repository](offline/)__ + +Using the sample Python script in **offline** folder, you will push the necessary images required for the deployment to your own repository. \ No newline at end of file diff --git a/samples/features/azure-arc-data-controller/deployment/aks/README.md b/samples/features/azure-arc-data-controller/deployment/aks/README.md new file mode 100644 index 00000000..349a1630 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/aks/README.md @@ -0,0 +1,49 @@ + +# Deploy a SQL Server big data cluster on Azure Kubernetes Service (AKS) + +Using this sample Python script, you will deploy a Kubernetes cluster in Azure using AKS and a SQL Server big data cluster using this AKS cluster as its environment. The script can be run from any client OS. + + +## Pre-requisites + +1. Install latest version of [az cli](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +1. Running the script will require: [python minimum version 3.0](https://www.python.org/downloads) +1. Install the latest version of [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) +1. Ensure you have installed `mssqlctl` CLI and its prerequisites: + - Install [pip3](https://pip.pypa.io/en/stable/installing/). + - Install/update requests package. Run the command below using elevated priviledges (sudo or admin cmd window): + ``` + python -m pip install requests + python -m pip install requests --upgrade + ``` + - Install latest version of the cluster management tool **azdata** (previously named mssqlctl) using below command. Run the command below using elevated priviledges (sudo or admin cmd window): + ``` + pip3 install -r https://aka.ms/azdata + ``` +1. Login into your Azure account. Run this command: +``` +az login +``` + +## Instructions + +Run the script using: +``` +python deploy-sql-big-data-aks.py +``` + +>**Note** +> +>If you have both python3 and python2 on your client machine and in the path, you will have to run the command using python3: +>``` +>python3 deploy-sql-big-data-aks.py +>``` + + +When prompted, provide your input for Azure subscription ID, Azure resource group to create the resources in, and Docker credentials. Optionally, you can also provide your input for below configurations or use the defaults provided: +- azure_region +- vm_size - we recommend to use a VM size to accommodate your workload. For an optimal experience while you are validating basic scenarios, we recommend at least 8 vCPUs and 64GB memory across all agent nodes in the cluster. The script uses **Standard_L8s** as default. A default size configuration also uses about 24 disks for persistent volume claims across all components. +- aks_node_count - this is the number of the worker nodes for the AKS cluster, excluding master node. The script is using a default of 1 agent node. This is the minimum required for this VM size to have enough resources and disks to provision all the necessary persistent volumes. +- cluster_name - this value is used for both AKS cluster and SQL big data cluster created on top of AKS. Note that the name of the SQL big data cluster is going to be a Kubernetes namespace +- password - same value is going to be used for all accounts that require user password input: SQL Server master instance account created for the below **username**, controller user and Knox **root** user +- username - this is the username for the accounts provisioned during deployment for the controller admin account and SQL Server master instance account. Note that **sa** SQL Server account is disabled automatically for you, as a best practice. Username for Knox gateway account is going to be **root**. diff --git a/samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py b/samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py new file mode 100644 index 00000000..cb71cff7 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py @@ -0,0 +1,102 @@ +# +# Prerequisites: +# +# Azure CLI (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), python3 (https://www.python.org/downloads), azdata CLI (pip3 install -r https://aka.ms/azdata) +# +# Run `az login` at least once BEFORE running this script +# + +from subprocess import check_output, CalledProcessError, STDOUT, Popen, PIPE +import os +import getpass + +def executeCmd (cmd): + if os.name=="nt": + process = Popen(cmd.split(),stdin=PIPE, shell=True) + else: + process = Popen(cmd.split(),stdin=PIPE) + stdout, stderr = process.communicate() + if (stderr is not None): + raise Exception(stderr) + +# +# MUST INPUT THESE VALUES!!!!! +# +SUBSCRIPTION_ID = input("Provide your Azure subscription ID:").strip() +GROUP_NAME = input("Provide Azure resource group name to be created:").strip() +# Use this only if you are using a private registry different than default Micrososft registry (mcr). +#DOCKER_USERNAME = input("Provide your Docker username:").strip() +#DOCKER_PASSWORD = getpass.getpass("Provide your Docker password:").strip() + +# +# Optionally change these configuration settings +# +AZURE_REGION=input("Provide Azure region - Press ENTER for using `westus`:").strip() or "westus" +VM_SIZE=input("Provide VM size for the AKS cluster - Press ENTER for using `Standard_L8s`:").strip() or "Standard_L8s" +AKS_NODE_COUNT=input("Provide number of worker nodes for AKS cluster - Press ENTER for using `1`:").strip() or "1" + +#This is both Kubernetes cluster name and SQL Big Data cluster name +CLUSTER_NAME=input("Provide name of AKS cluster and SQL big data cluster - Press ENTER for using `sqlbigdata`:").strip() or "sqlbigdata" + +#This password will be use for Controller user, Knox user and SQL Server Master SA accounts +# +AZDATA_USERNAME=input("Provide username to be used for Controller and SQL Server master accounts - Press ENTER for using `admin`:").strip() or "admin" +AZDATA_PASSWORD = getpass.getpass("Provide password to be used for Controller user, Knox user (root) and SQL Server Master accounts - Press ENTER for using `MySQLBigData2019`").strip() or "MySQLBigData2019" + +# Docker registry details +# Use this only if you are using a private registry different than mcr. If so, make sure you are also setting the environment variables for DOCKER_USERNAME and DOCKER_PASSWORD +# DOCKER_REGISTRY="" +# DOCKER_REPOSITORY="" +# DOCKER_IMAGE_TAG="" + +print ('Setting environment variables') +os.environ['AZDATA_PASSWORD'] = AZDATA_PASSWORD +os.environ['AZDATA_USERNAME'] = AZDATA_USERNAME +# Use this only if you are using a private registry different than mcr. If so, you must set the environment variables for DOCKER_USERNAME and DOCKER_PASSWORD +# os.environ['DOCKER_USERNAME']=DOCKER_USERNAME +# os.environ['DOCKER_PASSWORD']=DOCKER_PASSWORD +os.environ['ACCEPT_EULA']="Yes" + +print ("Set azure context to subcription: "+SUBSCRIPTION_ID) +command = "az account set -s "+ SUBSCRIPTION_ID +executeCmd (command) + +print ("Creating azure resource group: "+GROUP_NAME) +command="az group create --name "+GROUP_NAME+" --location "+AZURE_REGION +executeCmd (command) + +print("Creating AKS cluster: "+CLUSTER_NAME) +command = "az aks create --name "+CLUSTER_NAME+" --resource-group "+GROUP_NAME+" --generate-ssh-keys --node-vm-size "+VM_SIZE+" --node-count "+AKS_NODE_COUNT +executeCmd (command) + +command = "az aks get-credentials --overwrite-existing --name "+CLUSTER_NAME+" --resource-group "+GROUP_NAME+" --admin" +executeCmd (command) + +print("Creating SQL Big Data cluster:" +CLUSTER_NAME) +command="azdata bdc config init --source aks-dev-test --target custom --force" +executeCmd (command) + +command="azdata bdc config replace -c custom/bdc.json -j ""metadata.name=" + CLUSTER_NAME + "" +executeCmd (command) + +# Use this only if you are using a private registry different than default Micrososft registry (mcr). +# command="azdata bdc config replace -c custom/control.json -j ""$.spec.controlPlane.spec.docker.registry=" + DOCKER_REGISTRY + "" +# executeCmd (command) + +# command="azdata bdc config replace -c custom/control.json -j ""$.spec.controlPlane.spec.docker.repository=" + DOCKER_REPOSITORY + "" +# executeCmd (command) + +# command="azdata bdc config replace -c custom/control.json -j ""$.spec.controlPlane.spec.docker.imageTag=" + DOCKER_IMAGE_TAG + "" +# executeCmd (command) + +command="azdata bdc create -c custom --accept-eula yes" +executeCmd (command) + +command="azdata login -n " + CLUSTER_NAME +executeCmd (command) + +print("") +print("SQL Server big data cluster endpoints: ") +command="azdata bdc endpoint list -o table" +executeCmd(command) + diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md b/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md new file mode 100644 index 00000000..d129e144 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md @@ -0,0 +1,14 @@ +# Create a Kubernetes cluster using Kubeadm on Ubuntu 16.04 LTS or 18.04 LTS + + +## __[ubuntu](ubuntu/)__ + +This folder contains scripts that provide a template for deploying a Kubernetes cluster using kubeadm on one or more Linux machines. + +## __[ubuntu-single-node-vm](ubuntu-single-node-vm/)__ + +This folder contains a sample script that can be used to create a single-node Kubernetes cluster on a Linux machine and deploy SQL Server big data cluster. + +## __[ubuntu-single-node-vm-ad](ubuntu-single-node-vm-ad/)__ + +This folder contains a sample script that can be used to create a single-node Kubernetes cluster on a Linux machine and deploy SQL Server big data cluster with Active Directory integration. diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md new file mode 100644 index 00000000..adb926cd --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md @@ -0,0 +1,53 @@ + +# Deploy a SQL Server big data cluster on single node Kubernetes cluster (kubeadm) + +Using this sample bash script, you will deploy a single node Kubernetes cluster using kubeadm and a SQL Server big data cluster on top of it. The script must be run from the VM you are planning to use for your kubeadm deployment. + +## Pre-requisites + +1. A vanilla Ubuntu 16.04 or 18.04 virtual or physical machine. All dependencies will be setup by the script. Using Azure Linux VMs is not yet supported. +1. Machine should have at least 8 CPUs, 64GB RAM and 100GB disk space. After installing the images you will be left with 50GB for data/logs across all components. +1. Update existing packages using commands below to ensure that the OS image is up to date + +``` bash +sudo apt update&&apt upgrade -y +sudo systemctl reboot +``` + +## Recommended Virtual Machine settings + +1. Use static memory configuration for the virtual machine. For example, in hyper-v installations do not use dynamic memory allocation but instead allocate the recommended 64 GB or higher. + +1. Use checkpoint or snapshot capability in your hyper visor so that you can rollback the virtual machine to a clean state. + +## Instructions to deploy SQL Server big data cluster + +1. Download the script on the VM you are planning to use for the deployment + +``` bash +curl --output setup-bdc.sh https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu-single-node-vm/setup-bdc.sh +``` + +2. Make the script executable + +``` bash +chmod +x setup-bdc.sh +``` + +3. Run the script (make sure you are running with sudo) + +``` bash +sudo ./setup-bdc.sh +``` + +4. Refresh alias setup for azdata + +``` bash +source ~/.bashrc +``` + +When prompted, provide your input for the password that will be used for all external endpoints: controller, SQL Server master and gateway. The password should be sufficiently complex based on existing rules for SQL Server password. The controller username is defaulted to *admin*. + +## Cleanup + +1. The [cleanup-bdc.sh](cleanup-bdc.sh/) script is provided as convenience to reset the environment in case of errors. However, we recommend that you use a virtual machine for testing purposes and use the snapshot capability in your hyper-visor to rollback the virtual machine to a clean state. diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh new file mode 100644 index 00000000..9a53ae8c --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi +DIR_PREFIX=$1 + +kubeadm reset --force +unalias azdata + +systemctl stop kubelet +rm -rf /var/lib/cni/ +rm -rf /var/lib/etcd/ +rm -rf /run/flannel/ +rm -rf /var/lib/kubelet/* +rm -rf /etc/cni/ +rm -rf /etc/kubernetes/ + +ip link set cni0 down +#brctl delbr cni0 +ip link set flannel.1 down +#brctl delbr flannel.1 +iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X + +rm -rf .azdata/ +rm -rf bdcdeploy/ + +# Remove mounts. +# +SERVICE_STOP_FAILED=0 + +systemctl | grep "/var/lib/kubelet/pods" | while read -r line; do + + # Retrieve the mount path + # + MOUNT_PATH=`echo "$line" | grep -v echo | egrep -oh -m 1 "(/var/lib/kubelet/pods).+"` + + if [ -z "$MOUNT_PATH" ]; then + continue + fi + + if [[ ! -d "$MOUNT_PATH" ]] && [[ ! -f "$MOUNT_PATH" ]]; then + + SERVICE=$(echo $line | cut -f1 -d' ') + + echo "Mount "$MOUNT_PATH" no longer exists." + echo "Stopping orphaned mount service: '$SERVICE'" + + systemctl stop $SERVICE + + if [ $? -ne 0 ]; then + SERVICE_STOP_FAILED=1 + fi + + echo "" + fi +done + +if [ $SERVICE_STOP_FAILED -ne 0 ]; then + echo "Not all services were stopped successfully. Please check the above output for more inforamtion." +else + echo "All orphaned services successfully stopped." +fi + +# Clean the mounted volumes. +# + +for i in $(seq 1 30); do + + vol="vol$i" + + sudo umount /mnt/local-storage/$vol + + sudo rm -rf /mnt/local-storage/$vol + +done + +# Reset kube +# +sudo apt-get purge -y kubeadm --allow-change-held-packages +sudo apt-get purge -y kubectl --allow-change-held-packages +sudo apt-get purge -y kubelet --allow-change-held-packages +sudo apt-get purge -y kubernetes-cni --allow-change-held-packages +sudo apt-get purge -y kube* --allow-change-held-packages +sudo apt -y autoremove +sudo rm -rf ~/.kube diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh new file mode 100644 index 00000000..52421c06 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -0,0 +1,350 @@ +#!/bin/bash +set -Eeuo pipefail + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + +# This is a script to create single-node Kubernetes cluster and deploy Azure Arc Data Controller on it. +# +export AZUREARCDATACONTROLLER_DIR=aadatacontroller + +# Get password as input. It is used as default for controller, SQL Server Master instance (sa account). +# +while true; do + read -s -p "Create Password for Azure Arc Data Controller: " password + echo + read -s -p "Confirm your Password: " password2 + echo + [ "$password" = "$password2" ] && break + echo "Password mismatch. Please try again." +done + + +# Name of virtualenv variable used. +# +export VIRTUALENV_NAME="aadatacontrollervenv" +export LOG_FILE="aadatacontroller.log" +export DEBIAN_FRONTEND=noninteractive + +# Requirements file. +# +export REQUIREMENTS_LINK="https://aka.ms/aadatacontrollerazdata" + +# Kube version. +# +KUBE_DPKG_VERSION=1.15.0-00 +KUBE_VERSION=1.15.0 + +# Wait for 5 minutes for the cluster to be ready. +# +TIMEOUT=600 +RETRY_INTERVAL=5 + +# Variables for pulling dockers. +# +export DOCKER_REGISTRY="mcr.microsoft.com" +export DOCKER_REPOSITORY="azurearcdatacontroller" +export DOCKER_TAG="2019-AzureArcDataController-Preview" + +# Github related contstants +# TODO Change to master after testing. +# +GITHUB_AADATACONTROLLER_BRANCH=tina-private-preview + +# Variables used for azdata cluster creation. +# +export AZDATA_USERNAME=admin +export AZDATA_PASSWORD=$password +export ACCEPT_EULA=yes +export CLUSTER_NAME=test +export PV_COUNT="40" + +IMAGES=( + mssql-app-service-proxy + mssql-control-watchdog + mssql-controller + mssql-dns + mssql-hadoop + mssql-mleap-serving-runtime + mssql-mlserver-py-runtime + mssql-mlserver-r-runtime + mssql-monitor-collectd + mssql-monitor-elasticsearch + mssql-monitor-fluentbit + mssql-monitor-grafana + mssql-monitor-influxdb + mssql-monitor-kibana + mssql-monitor-telegraf + mssql-security-domainctl + mssql-security-knox + mssql-security-support + mssql-server + mssql-server-controller + mssql-server-data + mssql-ha-operator + mssql-ha-supervisor + mssql-service-proxy + mssql-ssis-app-runtime +) + + +# Make a directory for installing the scripts and logs. +# +mkdir -p $AZUREARCDATACONTROLLER_DIR +cd $AZUREARCDATACONTROLLER_DIR/ +touch $LOG_FILE + +{ +# Install all necessary packages: kuberenetes, docker, python3, python3-pip, request, azdata. +# +echo "" +echo "######################################################################################" +echo "Starting installing packages..." + +# Install docker. +# +apt-get update -q + +apt --yes install \ + software-properties-common \ + apt-transport-https \ + ca-certificates \ + curl + +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + +apt update -q +apt-get install -q --yes docker-ce=18.06.2~ce~3-0~ubuntu --allow-downgrades +apt-mark hold docker-ce + +usermod --append --groups docker $USER + +# Install python3, python3-pip, requests. +# +apt-get install -q -y python3 +apt-get install -q -y python3-pip +apt-get install -y libkrb5-dev +apt-get install -y libsqlite3-dev +apt-get install -y unixodbc-dev + +pip3 install requests --upgrade + +# Install and create virtualenv. +# +pip3 install --upgrade virtualenv +virtualenv -p python3 $VIRTUALENV_NAME +source $VIRTUALENV_NAME/bin/activate + +# Install azdata cli. +# +pip3 install -r $REQUIREMENTS_LINK +echo "Packages installed." + +# Load all pre-requisites for Kubernetes. +# +echo "###########################################################################" +echo "Starting to setup pre-requisites for kubernetes..." + +# Setup the kubernetes preprequisites. +# +echo $(hostname -i) $(hostname) >> /etc/hosts + +swapoff -a +sed -i '/swap/s/^\(.*\)$/#\1/g' /etc/fstab + +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - + +cat </etc/apt/sources.list.d/kubernetes.list + +deb http://apt.kubernetes.io/ kubernetes-xenial main + +EOF + +# Install docker and packages to allow apt to use a repository over HTTPS. +# +apt-get update -q + +apt-get install -q -y ebtables ethtool + +#apt-get install -y docker.ce + +apt-get install -q -y apt-transport-https + +# Setup daemon. +# +cat > /etc/docker/daemon.json < /etc/sysctl.conf +echo net.ipv6.conf.default.disable_ipv6=1 > /etc/sysctl.conf +echo net.ipv6.conf.lo.disable_ipv6=1 > /etc/sysctl.conf + + +sysctl net.bridge.bridge-nf-call-iptables=1 + +# Setting up the persistent volumes for the kubernetes. +# +for i in $(seq 1 $PV_COUNT); do + + vol="vol$i" + + mkdir -p /mnt/local-storage/$vol + + mount --bind /mnt/local-storage/$vol /mnt/local-storage/$vol + +done +echo "Kubernetes pre-requisites have been completed." + +# Setup kubernetes cluster including remove taint on master. +# +echo "" +echo "#############################################################################" +echo "Starting to setup Kubernetes master..." + +# Initialize a kubernetes cluster on the current node. +# +sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --kubernetes-version=$KUBE_VERSION + +mkdir -p $HOME/.kube +mkdir -p /home/$SUDO_USER/.kube + +sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config +sudo chown $(id -u $SUDO_USER):$(id -g $SUDO_USER) $HOME/.kube/config + +# To enable a single node cluster remove the taint that limits the first node to master only service. +# +master_node=`kubectl get nodes --no-headers=true --output=custom-columns=NAME:.metadata.name` +kubectl taint nodes ${master_node} node-role.kubernetes.io/master:NoSchedule- + +# Local storage provisioning. +# +kubectl apply -f https://raw.githubusercontent.com/microsoft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml + +# Install the software defined network. +# +kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml + +# helm init +# +kubectl apply -f https://raw.githubusercontent.com/microsoft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml + +# Verify that the cluster is ready to be used. +# +echo "Verifying that the cluster is ready for use..." +while true ; do + + if [[ "$TIMEOUT" -le 0 ]]; then + echo "Cluster node failed to reach the 'Ready' state. Kubeadm setup failed." + exit 1 + fi + + status=`kubectl get nodes --no-headers=true | awk '{print $2}'` + + if [ "$status" == "Ready" ]; then + break + fi + + sleep "$RETRY_INTERVAL" + + TIMEOUT=$(($TIMEOUT-$RETRY_INTERVAL)) + + echo "Cluster not ready. Retrying..." +done + + +# Install the dashboard for Kubernetes. +# +kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml + +kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard +echo "Kubernetes master setup done." + +# Pull docker images of Azure Arc Data Controller. +# +echo "" +echo "############################################################################" +echo "Starting to pull docker images..." +echo "Pulling images from repository: " $DOCKER_REGISTRY"/"$DOCKER_REPOSITORY + +for image in "${IMAGES[@]}"; +do + docker pull $DOCKER_REGISTRY/$DOCKER_REPOSITORY/$image:$DOCKER_TAG + echo "Docker image" $image " pulled." +done +echo "Docker images pulled." + +# Deploy azdata Azure Arc Data Cotnroller create cluster. +# +echo "" +echo "############################################################################" +echo "Starting to deploy azdata cluster..." + +# Command to create cluster for single node cluster. +# +azdata bdc config init --source tina-kubeadm-dev-test --target tina-kubeadm-custom -f +azdata bdc config replace -c kubeadm-custom/control.json -j ".spec.docker.repository=$DOCKER_REPOSITORY" +azdata bdc config replace -c kubeadm-custom/control.json -j ".spec.docker.registry=$DOCKER_REGISTRY" +azdata bdc config replace -c kubeadm-custom/control.json -j ".spec.docker.imageTag=$DOCKER_TAG" +azdata bdc config replace -c kubeadm-custom/dusky.json -j ".spec.docker.repository=$DOCKER_REPOSITORY" +azdata bdc config replace -c kubeadm-custom/dusky.json -j ".spec.docker.registry=$DOCKER_REGISTRY" +azdata bdc config replace -c kubeadm-custom/dusky.json -j ".spec.docker.imageTag=$DOCKER_TAG" +azdata bdc config replace -c kubeadm-custom/evergreen.json -j ".spec.docker.repository=$DOCKER_REPOSITORY" +azdata bdc config replace -c kubeadm-custom/evergreen.json -j ".spec.docker.registry=$DOCKER_REGISTRY" +azdata bdc config replace -c kubeadm-custom/evergreen.json -j ".spec.docker.imageTag=$DOCKER_TAG" +azdata control create -c tina-kubeadm-custom --accept-eula $ACCEPT_EULA +echo "Azure Arc Data Controller cluster created." + +# Setting context to cluster. +# +kubectl config set-context --current --namespace $CLUSTER_NAME + +# Login and get endpoint list for the cluster. +# +azdata login -n $CLUSTER_NAME +# TODO: For Tina do we want to expose any endpoints? +#azdata bdc endpoint list --output table + +if [ -d "$HOME/.azdata/" ]; then + sudo chown -R $(id -u $SUDO_USER):$(id -g $SUDO_USER) $HOME/.azdata/ +fi + +echo "alias azdata='$AZUREARCDATACONTROLLER_DIR/$VIRTUALENV_NAME/bin/azdata'" >> $HOME/.bashrc +}| tee $LOG_FILE diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md new file mode 100644 index 00000000..79d73ea7 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md @@ -0,0 +1,31 @@ +# Create a Kubernetes cluster using Kubeadm on Ubuntu 16.04 LTS or 18.04 LTS + +In this example, we will deploy Kubernetes over multiple Linux machines (physical or virtualized) using kubeadm utility. These instructions have been tested primarily with Ubuntu 16.04 LTS & 18.04 LTS versions. + +## Pre-requisites + +1. Multiple Ubuntu Linux machines or virtual machines. Recommended configuration is 8 CPUs, 32 GB memory each and at least 100 GB storage for each machine. Minimum number of machines required is three machines +1. Designate one machine as the Kubernetes master +1. Rest of the machines will be used as the Kubernetes agents + +**NOTE: Ensure there is sufficient local storage on your agents. Each volume will use up to 10GB by default. The script creates 25 volumes. Not all of the volumes will be used since it depends on the number of pods being deployed on each agent node. It is recommended to have at least 200 GB of storage on the agent nodes** + +### Useful resources + +[Deploy SQL Server 2019 big data cluster on Kubernetes](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions) + +[Creating a cluster using kubeadm](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/) + +[Troubleshooting kubeadm](https://kubernetes.io/docs/setup/independent/troubleshooting-kubeadm/) + +### Instructions + +1. Start a sudo shell context and Execute [setup-k8s-prereqs.sh](setup-k8s-prereqs.sh/) script on each machine +1. Execute [setup-k8s-master.sh](setup-k8s-master.sh/) script on the machine designated as Kubernetes master (_not_ under sudo su as otherwise you'll setup K8S .kube/config permissions for root) +1. After successful initialization of the Kubernetes master, follow the kubeadm join commands output by the setup script on each agent machine +1. Execute [setup-volumes-agent.sh](setup-volumes-agent.sh/) script on each agent machine to create volumes for local storage +1. Execute ***kubectl apply -f local-storage-provisioner.yaml*** against the Kubernetes cluster to create the local storage provisioner. This will create a Storage Class named "local-storage". +1. Now, you can deploy the SQL Server 2019 big data cluster following instructions [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions). +Simply type in "local-storage" twice (once for data, once for logs) when facing the following prompt by azdata : + +`Kubernetes Storage Class - Config Path: spec.storage.data.className - Description: This indicates the name of the Kubernetes Storage Class to use. You must pre-provision the storage class and the persistent volumes or you can use a built in storage class if the platform you are deploying provides this capability. - Please provide a value:` diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml new file mode 100644 index 00000000..3cf49834 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml @@ -0,0 +1,129 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: local-storage +--- +apiVersion: v1 +kind: Service +metadata: + name: local-volume-provisioner + namespace: local-storage + labels: + app: local-volume-provisioner +spec: + type: ClusterIP + selector: + app: local-volume-provisioner + ports: + - name: metrics + port: 8080 + protocol: TCP +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-storage +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer +reclaimPolicy: Delete +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: local-provisioner-config + namespace: local-storage +data: + storageClassMap: | + local-storage: + hostDir: /mnt/local-storage + mountDir: /mnt/local-storage + blockCleanerCommand: + - "/scripts/shred.sh" + - "2" +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: local-volume-provisioner + namespace: local-storage + labels: + app: local-volume-provisioner +spec: + selector: + matchLabels: + app: local-volume-provisioner + template: + metadata: + labels: + app: local-volume-provisioner + spec: + serviceAccountName: local-storage-admin + containers: + - image: "quay.io/external_storage/local-volume-provisioner:v2.1.0" + imagePullPolicy: "Always" + name: provisioner + securityContext: + privileged: true + env: + - name: MY_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - mountPath: /etc/provisioner/config + name: provisioner-config + readOnly: true + - mountPath: /mnt/local-storage + name: local-storage + mountPropagation: "HostToContainer" + volumes: + - name: provisioner-config + configMap: + name: local-provisioner-config + - name: local-storage + hostPath: + path: /mnt/local-storage +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: local-storage-admin + namespace: local-storage +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: local-storage-provisioner-pv-binding + namespace: local-storage +subjects: +- kind: ServiceAccount + name: local-storage-admin + namespace: local-storage +roleRef: + kind: ClusterRole + name: system:persistent-volume-provisioner + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: local-storage-provisioner-node-clusterrole + namespace: local-storage +rules: +- apiGroups: [""] + resources: ["nodes"] + verbs: ["get"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: local-storage-provisioner-node-binding + namespace: local-storage +subjects: +- kind: ServiceAccount + name: local-storage-admin + namespace: local-storage +roleRef: + kind: ClusterRole + name: local-storage-provisioner-node-clusterrole + apiGroup: rbac.authorization.k8s.io diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml new file mode 100644 index 00000000..d60c3361 --- /dev/null +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: default-rbac +subjects: +- kind: ServiceAccount + name: default + namespace: default +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io From 8ad655708c6e7a1e9714ced2896d3397f14dab7c Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Thu, 14 Nov 2019 16:12:43 -0800 Subject: [PATCH 02/10] Fixing white spaces. --- .../kubeadm/ubuntu-single-node-vm/setup-controller.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index 52421c06..99167481 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -62,7 +62,7 @@ export CLUSTER_NAME=test export PV_COUNT="40" IMAGES=( - mssql-app-service-proxy + mssql-app-service-proxy mssql-control-watchdog mssql-controller mssql-dns @@ -84,7 +84,7 @@ IMAGES=( mssql-server-controller mssql-server-data mssql-ha-operator - mssql-ha-supervisor + mssql-ha-supervisor mssql-service-proxy mssql-ssis-app-runtime ) From 11a930d4834c65d01d599d924883ffc6cad456c6 Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Tue, 19 Nov 2019 12:39:12 -0800 Subject: [PATCH 03/10] Tina preview script changes. --- .../cleanup-controller.sh | 14 +- .../ubuntu-single-node-vm/setup-controller.sh | 121 ++++++------------ 2 files changed, 55 insertions(+), 80 deletions(-) diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh index 9a53ae8c..ed6dc795 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh @@ -7,7 +7,11 @@ fi DIR_PREFIX=$1 kubeadm reset --force + +# Clean up azdata-cli package. +# unalias azdata +sudo dpkg --remove --force-all azdata-cli systemctl stop kubelet rm -rf /var/lib/cni/ @@ -66,7 +70,7 @@ fi # Clean the mounted volumes. # -for i in $(seq 1 30); do +for i in $(seq 1 40); do vol="vol$i" @@ -85,3 +89,11 @@ sudo apt-get purge -y kubernetes-cni --allow-change-held-packages sudo apt-get purge -y kube* --allow-change-held-packages sudo apt -y autoremove sudo rm -rf ~/.kube + +# Clean up working folders. +# +export AZUREARCDATACONTROLLER_DIR=aadatacontroller +if [ -d "$AZUREARCDATACONTROLLER_DIR" ]; then + echo "Removing working directory $AZUREARCDATACONTROLLER_DIR." + rm -f -r $AZUREARCDATACONTROLLER_DIR +fi diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index 99167481..b1a1794a 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -21,7 +21,6 @@ while true; do echo "Password mismatch. Please try again." done - # Name of virtualenv variable used. # export VIRTUALENV_NAME="aadatacontrollervenv" @@ -29,8 +28,7 @@ export LOG_FILE="aadatacontroller.log" export DEBIAN_FRONTEND=noninteractive # Requirements file. -# -export REQUIREMENTS_LINK="https://aka.ms/aadatacontrollerazdata" +export AZDATA_PRIVATE_PREVIEW_DEB_PACKAGE="https://aka.ms/aadatacontrollerazdata" # Kube version. # @@ -44,9 +42,9 @@ RETRY_INTERVAL=5 # Variables for pulling dockers. # -export DOCKER_REGISTRY="mcr.microsoft.com" -export DOCKER_REPOSITORY="azurearcdatacontroller" -export DOCKER_TAG="2019-AzureArcDataController-Preview" +export DOCKER_REGISTRY="azurehybriddata.azurecr.io" +export DOCKER_REPOSITORY="hybrid" +export DOCKER_TAG="ignite-11-01" # Github related contstants # TODO Change to master after testing. @@ -57,41 +55,23 @@ GITHUB_AADATACONTROLLER_BRANCH=tina-private-preview # export AZDATA_USERNAME=admin export AZDATA_PASSWORD=$password + +export DOMAIN_SERVICE_ACCOUNT_USERNAME=admin +export DOMAIN_SERVICE_ACCOUNT_PASSWORD=$password + +export CONTROLLER_USERNAME=controlleradmin +export CONTROLLER_PASSWORD=$password + +export MSSQL_SA_PASSWORD=$password +export KNOX_PASSWORD=$password + export ACCEPT_EULA=yes -export CLUSTER_NAME=test +export CLUSTER_NAME=mssql-cluster export PV_COUNT="40" -IMAGES=( - mssql-app-service-proxy - mssql-control-watchdog - mssql-controller - mssql-dns - mssql-hadoop - mssql-mleap-serving-runtime - mssql-mlserver-py-runtime - mssql-mlserver-r-runtime - mssql-monitor-collectd - mssql-monitor-elasticsearch - mssql-monitor-fluentbit - mssql-monitor-grafana - mssql-monitor-influxdb - mssql-monitor-kibana - mssql-monitor-telegraf - mssql-security-domainctl - mssql-security-knox - mssql-security-support - mssql-server - mssql-server-controller - mssql-server-data - mssql-ha-operator - mssql-ha-supervisor - mssql-service-proxy - mssql-ssis-app-runtime -) - - # Make a directory for installing the scripts and logs. # +rm -f -r $AZUREARCDATACONTROLLER_DIR mkdir -p $AZUREARCDATACONTROLLER_DIR cd $AZUREARCDATACONTROLLER_DIR/ touch $LOG_FILE @@ -124,26 +104,34 @@ apt-mark hold docker-ce usermod --append --groups docker $USER -# Install python3, python3-pip, requests. +# Prompt for private preview repository username and password provided by Microsoft # -apt-get install -q -y python3 -apt-get install -q -y python3-pip -apt-get install -y libkrb5-dev -apt-get install -y libsqlite3-dev -apt-get install -y unixodbc-dev +read -p 'Enter Azure Arc Data Controller repo username provided by Microsoft:' AADC_USERNAME +read -sp 'Enter Azure Arc Data Controller repo password provided by Microsoft:' AADC_PASSWORD +export DOCKER_USERNAME=$AADC_USERNAME +export DOCKER_PASSWORD=$AADC_PASSWORD -pip3 install requests --upgrade +#TODO: Remove after testing +export DOCKER_USERNAME=azurehybriddata +export DOCKER_PASSWORD=lmSIm9BwGt3N6s0/om3qf/15S7R64KsY -# Install and create virtualenv. +# Create working directory # -pip3 install --upgrade virtualenv -virtualenv -p python3 $VIRTUALENV_NAME -source $VIRTUALENV_NAME/bin/activate +rm -f -r setupscript +mkdir -p setupscript +cd setupscript/ -# Install azdata cli. +# Download and install azdata package # -pip3 install -r $REQUIREMENTS_LINK -echo "Packages installed." +# TODO: Uncomment when have actual URL with the azdata package. +#curl azdata_setup.deb -u $AZDATA_PRIVATE_PREVIEW_DEB_PACKAGE +cp ./../../azdata-cli_15.0.2100-1_all.deb azdata_setup.deb +sudo dpkg -i azdata_setup.deb +cd - + +azdata --version +echo "Azdata has been successfully installed." + # Load all pre-requisites for Kubernetes. # @@ -256,7 +244,7 @@ kubectl taint nodes ${master_node} node-role.kubernetes.io/master:NoSchedule- # Local storage provisioning. # -kubectl apply -f https://raw.githubusercontent.com/microsoft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml +kubectl apply -f https://raw.githubusercontent.com/ananto-msft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml # Install the software defined network. # @@ -264,7 +252,7 @@ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documen # helm init # -kubectl apply -f https://raw.githubusercontent.com/microsoft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml +kubectl apply -f https://raw.githubusercontent.com/ananto-msft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml # Verify that the cluster is ready to be used. # @@ -297,20 +285,6 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/ kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard echo "Kubernetes master setup done." -# Pull docker images of Azure Arc Data Controller. -# -echo "" -echo "############################################################################" -echo "Starting to pull docker images..." -echo "Pulling images from repository: " $DOCKER_REGISTRY"/"$DOCKER_REPOSITORY - -for image in "${IMAGES[@]}"; -do - docker pull $DOCKER_REGISTRY/$DOCKER_REPOSITORY/$image:$DOCKER_TAG - echo "Docker image" $image " pulled." -done -echo "Docker images pulled." - # Deploy azdata Azure Arc Data Cotnroller create cluster. # echo "" @@ -319,17 +293,7 @@ echo "Starting to deploy azdata cluster..." # Command to create cluster for single node cluster. # -azdata bdc config init --source tina-kubeadm-dev-test --target tina-kubeadm-custom -f -azdata bdc config replace -c kubeadm-custom/control.json -j ".spec.docker.repository=$DOCKER_REPOSITORY" -azdata bdc config replace -c kubeadm-custom/control.json -j ".spec.docker.registry=$DOCKER_REGISTRY" -azdata bdc config replace -c kubeadm-custom/control.json -j ".spec.docker.imageTag=$DOCKER_TAG" -azdata bdc config replace -c kubeadm-custom/dusky.json -j ".spec.docker.repository=$DOCKER_REPOSITORY" -azdata bdc config replace -c kubeadm-custom/dusky.json -j ".spec.docker.registry=$DOCKER_REGISTRY" -azdata bdc config replace -c kubeadm-custom/dusky.json -j ".spec.docker.imageTag=$DOCKER_TAG" -azdata bdc config replace -c kubeadm-custom/evergreen.json -j ".spec.docker.repository=$DOCKER_REPOSITORY" -azdata bdc config replace -c kubeadm-custom/evergreen.json -j ".spec.docker.registry=$DOCKER_REGISTRY" -azdata bdc config replace -c kubeadm-custom/evergreen.json -j ".spec.docker.imageTag=$DOCKER_TAG" -azdata control create -c tina-kubeadm-custom --accept-eula $ACCEPT_EULA +azdata control create -c tina-kubeadm-dev-test --accept-eula $ACCEPT_EULA echo "Azure Arc Data Controller cluster created." # Setting context to cluster. @@ -339,8 +303,7 @@ kubectl config set-context --current --namespace $CLUSTER_NAME # Login and get endpoint list for the cluster. # azdata login -n $CLUSTER_NAME -# TODO: For Tina do we want to expose any endpoints? -#azdata bdc endpoint list --output table +azdata bdc endpoint list --output table if [ -d "$HOME/.azdata/" ]; then sudo chown -R $(id -u $SUDO_USER):$(id -g $SUDO_USER) $HOME/.azdata/ From 51610ea9f60bf48153adc5d745b6866d72c9bcf0 Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Tue, 19 Nov 2019 15:17:04 -0800 Subject: [PATCH 04/10] Refactoring. --- .../ubuntu-single-node-vm/setup-controller.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index b1a1794a..4af63efe 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -23,7 +23,6 @@ done # Name of virtualenv variable used. # -export VIRTUALENV_NAME="aadatacontrollervenv" export LOG_FILE="aadatacontroller.log" export DEBIAN_FRONTEND=noninteractive @@ -40,12 +39,6 @@ KUBE_VERSION=1.15.0 TIMEOUT=600 RETRY_INTERVAL=5 -# Variables for pulling dockers. -# -export DOCKER_REGISTRY="azurehybriddata.azurecr.io" -export DOCKER_REPOSITORY="hybrid" -export DOCKER_TAG="ignite-11-01" - # Github related contstants # TODO Change to master after testing. # @@ -111,10 +104,6 @@ read -sp 'Enter Azure Arc Data Controller repo password provided by Microsoft:' export DOCKER_USERNAME=$AADC_USERNAME export DOCKER_PASSWORD=$AADC_PASSWORD -#TODO: Remove after testing -export DOCKER_USERNAME=azurehybriddata -export DOCKER_PASSWORD=lmSIm9BwGt3N6s0/om3qf/15S7R64KsY - # Create working directory # rm -f -r setupscript @@ -123,9 +112,7 @@ cd setupscript/ # Download and install azdata package # -# TODO: Uncomment when have actual URL with the azdata package. -#curl azdata_setup.deb -u $AZDATA_PRIVATE_PREVIEW_DEB_PACKAGE -cp ./../../azdata-cli_15.0.2100-1_all.deb azdata_setup.deb +curl --location $AZDATA_PRIVATE_PREVIEW_DEB_PACKAGE --output azdata_setup.deb sudo dpkg -i azdata_setup.deb cd - @@ -309,5 +296,5 @@ if [ -d "$HOME/.azdata/" ]; then sudo chown -R $(id -u $SUDO_USER):$(id -g $SUDO_USER) $HOME/.azdata/ fi -echo "alias azdata='$AZUREARCDATACONTROLLER_DIR/$VIRTUALENV_NAME/bin/azdata'" >> $HOME/.bashrc +echo "Cluster successfully setup. Run 'azdata --help' to see all available options." }| tee $LOG_FILE From f1de60a08cb18479dff7ca3d617973f10b26fe99 Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Tue, 19 Nov 2019 15:24:38 -0800 Subject: [PATCH 05/10] Using the new config and master branch in github. --- .../kubeadm/ubuntu-single-node-vm/setup-controller.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index 4af63efe..04b59928 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -40,9 +40,8 @@ TIMEOUT=600 RETRY_INTERVAL=5 # Github related contstants -# TODO Change to master after testing. # -GITHUB_AADATACONTROLLER_BRANCH=tina-private-preview +GITHUB_AADATACONTROLLER_BRANCH=master # Variables used for azdata cluster creation. # @@ -280,7 +279,7 @@ echo "Starting to deploy azdata cluster..." # Command to create cluster for single node cluster. # -azdata control create -c tina-kubeadm-dev-test --accept-eula $ACCEPT_EULA +azdata control create -c tina-kubeadm-private-preview --accept-eula $ACCEPT_EULA echo "Azure Arc Data Controller cluster created." # Setting context to cluster. From a213a0e7cbc062e24e218a0d9a742a06b516cb2a Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Tue, 19 Nov 2019 17:48:03 -0800 Subject: [PATCH 06/10] Removing unused scripts. --- .../deployment/aks/README.md | 49 --------- .../deployment/aks/deploy-controller-aks.py | 102 ------------------ 2 files changed, 151 deletions(-) delete mode 100644 samples/features/azure-arc-data-controller/deployment/aks/README.md delete mode 100644 samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py diff --git a/samples/features/azure-arc-data-controller/deployment/aks/README.md b/samples/features/azure-arc-data-controller/deployment/aks/README.md deleted file mode 100644 index 349a1630..00000000 --- a/samples/features/azure-arc-data-controller/deployment/aks/README.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Deploy a SQL Server big data cluster on Azure Kubernetes Service (AKS) - -Using this sample Python script, you will deploy a Kubernetes cluster in Azure using AKS and a SQL Server big data cluster using this AKS cluster as its environment. The script can be run from any client OS. - - -## Pre-requisites - -1. Install latest version of [az cli](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) -1. Running the script will require: [python minimum version 3.0](https://www.python.org/downloads) -1. Install the latest version of [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -1. Ensure you have installed `mssqlctl` CLI and its prerequisites: - - Install [pip3](https://pip.pypa.io/en/stable/installing/). - - Install/update requests package. Run the command below using elevated priviledges (sudo or admin cmd window): - ``` - python -m pip install requests - python -m pip install requests --upgrade - ``` - - Install latest version of the cluster management tool **azdata** (previously named mssqlctl) using below command. Run the command below using elevated priviledges (sudo or admin cmd window): - ``` - pip3 install -r https://aka.ms/azdata - ``` -1. Login into your Azure account. Run this command: -``` -az login -``` - -## Instructions - -Run the script using: -``` -python deploy-sql-big-data-aks.py -``` - ->**Note** -> ->If you have both python3 and python2 on your client machine and in the path, you will have to run the command using python3: ->``` ->python3 deploy-sql-big-data-aks.py ->``` - - -When prompted, provide your input for Azure subscription ID, Azure resource group to create the resources in, and Docker credentials. Optionally, you can also provide your input for below configurations or use the defaults provided: -- azure_region -- vm_size - we recommend to use a VM size to accommodate your workload. For an optimal experience while you are validating basic scenarios, we recommend at least 8 vCPUs and 64GB memory across all agent nodes in the cluster. The script uses **Standard_L8s** as default. A default size configuration also uses about 24 disks for persistent volume claims across all components. -- aks_node_count - this is the number of the worker nodes for the AKS cluster, excluding master node. The script is using a default of 1 agent node. This is the minimum required for this VM size to have enough resources and disks to provision all the necessary persistent volumes. -- cluster_name - this value is used for both AKS cluster and SQL big data cluster created on top of AKS. Note that the name of the SQL big data cluster is going to be a Kubernetes namespace -- password - same value is going to be used for all accounts that require user password input: SQL Server master instance account created for the below **username**, controller user and Knox **root** user -- username - this is the username for the accounts provisioned during deployment for the controller admin account and SQL Server master instance account. Note that **sa** SQL Server account is disabled automatically for you, as a best practice. Username for Knox gateway account is going to be **root**. diff --git a/samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py b/samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py deleted file mode 100644 index cb71cff7..00000000 --- a/samples/features/azure-arc-data-controller/deployment/aks/deploy-controller-aks.py +++ /dev/null @@ -1,102 +0,0 @@ -# -# Prerequisites: -# -# Azure CLI (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), python3 (https://www.python.org/downloads), azdata CLI (pip3 install -r https://aka.ms/azdata) -# -# Run `az login` at least once BEFORE running this script -# - -from subprocess import check_output, CalledProcessError, STDOUT, Popen, PIPE -import os -import getpass - -def executeCmd (cmd): - if os.name=="nt": - process = Popen(cmd.split(),stdin=PIPE, shell=True) - else: - process = Popen(cmd.split(),stdin=PIPE) - stdout, stderr = process.communicate() - if (stderr is not None): - raise Exception(stderr) - -# -# MUST INPUT THESE VALUES!!!!! -# -SUBSCRIPTION_ID = input("Provide your Azure subscription ID:").strip() -GROUP_NAME = input("Provide Azure resource group name to be created:").strip() -# Use this only if you are using a private registry different than default Micrososft registry (mcr). -#DOCKER_USERNAME = input("Provide your Docker username:").strip() -#DOCKER_PASSWORD = getpass.getpass("Provide your Docker password:").strip() - -# -# Optionally change these configuration settings -# -AZURE_REGION=input("Provide Azure region - Press ENTER for using `westus`:").strip() or "westus" -VM_SIZE=input("Provide VM size for the AKS cluster - Press ENTER for using `Standard_L8s`:").strip() or "Standard_L8s" -AKS_NODE_COUNT=input("Provide number of worker nodes for AKS cluster - Press ENTER for using `1`:").strip() or "1" - -#This is both Kubernetes cluster name and SQL Big Data cluster name -CLUSTER_NAME=input("Provide name of AKS cluster and SQL big data cluster - Press ENTER for using `sqlbigdata`:").strip() or "sqlbigdata" - -#This password will be use for Controller user, Knox user and SQL Server Master SA accounts -# -AZDATA_USERNAME=input("Provide username to be used for Controller and SQL Server master accounts - Press ENTER for using `admin`:").strip() or "admin" -AZDATA_PASSWORD = getpass.getpass("Provide password to be used for Controller user, Knox user (root) and SQL Server Master accounts - Press ENTER for using `MySQLBigData2019`").strip() or "MySQLBigData2019" - -# Docker registry details -# Use this only if you are using a private registry different than mcr. If so, make sure you are also setting the environment variables for DOCKER_USERNAME and DOCKER_PASSWORD -# DOCKER_REGISTRY="" -# DOCKER_REPOSITORY="" -# DOCKER_IMAGE_TAG="" - -print ('Setting environment variables') -os.environ['AZDATA_PASSWORD'] = AZDATA_PASSWORD -os.environ['AZDATA_USERNAME'] = AZDATA_USERNAME -# Use this only if you are using a private registry different than mcr. If so, you must set the environment variables for DOCKER_USERNAME and DOCKER_PASSWORD -# os.environ['DOCKER_USERNAME']=DOCKER_USERNAME -# os.environ['DOCKER_PASSWORD']=DOCKER_PASSWORD -os.environ['ACCEPT_EULA']="Yes" - -print ("Set azure context to subcription: "+SUBSCRIPTION_ID) -command = "az account set -s "+ SUBSCRIPTION_ID -executeCmd (command) - -print ("Creating azure resource group: "+GROUP_NAME) -command="az group create --name "+GROUP_NAME+" --location "+AZURE_REGION -executeCmd (command) - -print("Creating AKS cluster: "+CLUSTER_NAME) -command = "az aks create --name "+CLUSTER_NAME+" --resource-group "+GROUP_NAME+" --generate-ssh-keys --node-vm-size "+VM_SIZE+" --node-count "+AKS_NODE_COUNT -executeCmd (command) - -command = "az aks get-credentials --overwrite-existing --name "+CLUSTER_NAME+" --resource-group "+GROUP_NAME+" --admin" -executeCmd (command) - -print("Creating SQL Big Data cluster:" +CLUSTER_NAME) -command="azdata bdc config init --source aks-dev-test --target custom --force" -executeCmd (command) - -command="azdata bdc config replace -c custom/bdc.json -j ""metadata.name=" + CLUSTER_NAME + "" -executeCmd (command) - -# Use this only if you are using a private registry different than default Micrososft registry (mcr). -# command="azdata bdc config replace -c custom/control.json -j ""$.spec.controlPlane.spec.docker.registry=" + DOCKER_REGISTRY + "" -# executeCmd (command) - -# command="azdata bdc config replace -c custom/control.json -j ""$.spec.controlPlane.spec.docker.repository=" + DOCKER_REPOSITORY + "" -# executeCmd (command) - -# command="azdata bdc config replace -c custom/control.json -j ""$.spec.controlPlane.spec.docker.imageTag=" + DOCKER_IMAGE_TAG + "" -# executeCmd (command) - -command="azdata bdc create -c custom --accept-eula yes" -executeCmd (command) - -command="azdata login -n " + CLUSTER_NAME -executeCmd (command) - -print("") -print("SQL Server big data cluster endpoints: ") -command="azdata bdc endpoint list -o table" -executeCmd(command) - From 6914f8111c08ce9338f832211abad6b738e386fc Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Tue, 19 Nov 2019 21:01:35 -0800 Subject: [PATCH 07/10] Editorial of the readme.md files. --- .../azure-arc-data-controller/README.md | 59 +------------------ .../deployment/README.md | 14 +---- .../deployment/kubeadm/README.md | 6 +- .../kubeadm/ubuntu-single-node-vm/README.md | 22 +++---- .../deployment/kubeadm/ubuntu/README.md | 6 -- 5 files changed, 14 insertions(+), 93 deletions(-) diff --git a/samples/features/azure-arc-data-controller/README.md b/samples/features/azure-arc-data-controller/README.md index 8a68db32..6bbbf149 100644 --- a/samples/features/azure-arc-data-controller/README.md +++ b/samples/features/azure-arc-data-controller/README.md @@ -1,59 +1,4 @@ -# Azure Arc Data Controller clusters - -Installation instructions for SQL Server 2019 big data clusters can be found [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sql-server-ver15). +# Azure Arc Data Controller cluster ## Samples Setup - -**Before you begin**, load the sample data into your big data cluster. For instructions, see [Load sample data into a SQL Server 2019 big data cluster](https://docs.microsoft.com/en-us/sql/big-data-cluster/tutorial-load-sample-data). - -## Executing the sample scripts -The scripts should be executed in a specific order to test the various features. Execute the scripts from each folder in below order: - -1. __[spark/data-loading/transform-csv-files.ipynb](spark/data-loading/transform-csv-files.ipynb)__ -1. __[data-virtualization/generic-odbc](data-virtualization/generic-odbc)__ -1. __[data-virtualization/hadoop](data-virtualization/hadoop)__ -1. __[data-virtualization/storage-pool](data-virtualization/storage-pool)__ -1. __[data-virtualization/oracle](data-virtualization/oracle)__ -1. __[data-pool](data-pool/)__ -1. __[machine-learning/sql/r](machine-learning/sql/r)__ -1. __[machine-learning/sql/python](machine-learning/sql/python)__ - -## __[data-pool](data-pool/)__ - -SQL Server 2019 big data cluster contains a data pool which consists of many SQL Server instances to store data & query in a scale-out manner. - -### Data ingestion using Spark -The sample script [data-pool/data-ingestion-spark.sql](data-pool/data-ingestion-spark.sql) shows how to perform data ingestion from Spark into data pool table(s). - -### Data ingestion using sql -The sample script [data-pool/data-ingestion-sql.sql](data-pool/data-ingestion-sql.sql) shows how to perform data ingestion from T-SQL into data pool table(s). - -## __[data-virtualization](data-virtualization/)__ - -SQL Server 2019 or SQL Server 2019 big data cluster can use PolyBase external tables to connect to other data sources. - -### External table over Generic ODBC data source -The [data-virtualization/generic-odbc](data-virtualization/generic-odbc) folder contains samples that demonstrate how to query data in MySQL & PostgreSQL using external tables and generic ODBC data source. The generic ODBC data soruce can be used only in SQL Server 2019 on Windows. - -### External table over Hadoop -The [data-virtualization/hadoop](data-virtualization/hadoop) folder contains samples that demonstrate how to query data in HDFS using external tables. This demonstrates the functionality available from SQL Server 2016 using the HADOOP data source. - -### External table over Oracle -The [data-virtualization/oracle](data-virtualization/oracle) folder contains samples that demonstrate how to query data in Oracle using external tables. - -### External table over Storage Pool -SQL Server 2019 big data cluster contains a storage pool consisting of HDFS, Spark and SQL Server instances. The [data-virtualization/storage-pool](data-virtualization/storage-pool) folder contains samples that demonstrate how to query data in HDFS inside SQL Server 2019 big data cluster. - -## __[deployment](deployment/)__ - -The [deployment](deployment) folder contains the scripts for deploying a Kubernetes cluster for SQL Server 2019 big data cluster. - -## __[machine-learning](machine-learning/)__ - -SQL Server 2016 added support executing R scripts from T-SQL. SQL Server 2017 added support for executing Python scripts from T-SQL. SQL Server 2019 adds support for executing Java code from T-SQL. SQL Server 2019 big data cluster adds support for executing Spark code inside the big data cluster. - -### SQL Server Machine Learning Services -The [machine-learning\sql](machine-learning\sql) folder contains the sample SQL scripts that show how to invoke R, Python, and Java code from T-SQL. - -### Spark Machine Learning -The [machine-learning\spark](machine-learning\spark) folder contains the Spark samples. +Follow the instrutions here: https://raw.githubusercontent.com/ananto-msft/sql-server-samples/master/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md diff --git a/samples/features/azure-arc-data-controller/deployment/README.md b/samples/features/azure-arc-data-controller/deployment/README.md index fe5ec277..70ca9f19 100644 --- a/samples/features/azure-arc-data-controller/deployment/README.md +++ b/samples/features/azure-arc-data-controller/deployment/README.md @@ -1,16 +1,8 @@ -# Creating a Kubernetes cluster for SQL Server 2019 big data cluster +# Creating a Kubernetes cluster for Azure Arc Data Controller cluster -SQL Server 2019 big data cluster is deployed as docker containers on a Kubernetes cluster. These samples provide scripts that can be used to provision a Kubernetes clusters using different environments. +Azure Arc Data Controller cluster is deployed as docker containers on a Kubernetes cluster. These samples provide scripts that can be used to provision a Kubernetes clusters using different environments. ## __[Deploy a Kubernetes cluster using kubeadm](kubeadm/)__ -Use the scripts in the **kubeadm** folder to deploy a Kubernetes cluster over one or more Linux machines (physical or virtualized) using `kubeadm` utility. - -## __[Deploy a SQL Server big data cluster on Azure Kubernetes Service (AKS)](aks/)__ - -Using the sample Python script in **aks** folder, you will deploy a Kubernetes cluster in Azure using AKS and a SQL Server big data cluster using on top of it. - -## __[Push SQL Server big data cluster images to your own private Docker repository](offline/)__ - -Using the sample Python script in **offline** folder, you will push the necessary images required for the deployment to your own repository. \ No newline at end of file +Use the scripts in the **kubeadm** folder to deploy a Kubernetes cluster over one or more Linux machines (physical or virtualized) using `kubeadm` utility. \ No newline at end of file diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md b/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md index d129e144..6a482e79 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md @@ -7,8 +7,4 @@ This folder contains scripts that provide a template for deploying a Kubernetes ## __[ubuntu-single-node-vm](ubuntu-single-node-vm/)__ -This folder contains a sample script that can be used to create a single-node Kubernetes cluster on a Linux machine and deploy SQL Server big data cluster. - -## __[ubuntu-single-node-vm-ad](ubuntu-single-node-vm-ad/)__ - -This folder contains a sample script that can be used to create a single-node Kubernetes cluster on a Linux machine and deploy SQL Server big data cluster with Active Directory integration. +This folder contains a sample script that can be used to create a single-node Kubernetes cluster on a Linux machine and deploy Azure Arc Data Controller cluster. diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md index adb926cd..ba028a52 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md @@ -1,7 +1,7 @@ -# Deploy a SQL Server big data cluster on single node Kubernetes cluster (kubeadm) +# Deploy a Azure Arc Data Controller on single node Kubernetes cluster (kubeadm) -Using this sample bash script, you will deploy a single node Kubernetes cluster using kubeadm and a SQL Server big data cluster on top of it. The script must be run from the VM you are planning to use for your kubeadm deployment. +Using this sample bash script, you will deploy a single node Kubernetes cluster using kubeadm and a Azure Arc Data Controller on top of it. The script must be run from the VM you are planning to use for your kubeadm deployment. ## Pre-requisites @@ -20,34 +20,28 @@ sudo systemctl reboot 1. Use checkpoint or snapshot capability in your hyper visor so that you can rollback the virtual machine to a clean state. -## Instructions to deploy SQL Server big data cluster +## Instructions to deploy Azure Arc Data Controller 1. Download the script on the VM you are planning to use for the deployment ``` bash -curl --output setup-bdc.sh https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu-single-node-vm/setup-bdc.sh +curl --output setup-controller.sh https://raw.githubusercontent.com/ananto-msft/sql-server-samples/master/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh ``` 2. Make the script executable ``` bash -chmod +x setup-bdc.sh +chmod +x setup-controller.sh ``` 3. Run the script (make sure you are running with sudo) ``` bash -sudo ./setup-bdc.sh +sudo ./setup-controller.sh ``` -4. Refresh alias setup for azdata - -``` bash -source ~/.bashrc -``` - -When prompted, provide your input for the password that will be used for all external endpoints: controller, SQL Server master and gateway. The password should be sufficiently complex based on existing rules for SQL Server password. The controller username is defaulted to *admin*. +When prompted, provide your input for the password that will be used for all external endpoints: controller, SQL Server master and gateway. The password should be sufficiently complex based on existing rules for SQL Server password. The controller username is defaulted to *controlleradmin*. ## Cleanup -1. The [cleanup-bdc.sh](cleanup-bdc.sh/) script is provided as convenience to reset the environment in case of errors. However, we recommend that you use a virtual machine for testing purposes and use the snapshot capability in your hyper-visor to rollback the virtual machine to a clean state. +1. The [cleanup-controller.sh](cleanup-controller.sh/) script is provided as convenience to reset the environment in case of errors. However, we recommend that you use a virtual machine for testing purposes and use the snapshot capability in your hyper-visor to rollback the virtual machine to a clean state. diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md index 79d73ea7..ad17a2a2 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md +++ b/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md @@ -12,8 +12,6 @@ In this example, we will deploy Kubernetes over multiple Linux machines (physica ### Useful resources -[Deploy SQL Server 2019 big data cluster on Kubernetes](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions) - [Creating a cluster using kubeadm](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/) [Troubleshooting kubeadm](https://kubernetes.io/docs/setup/independent/troubleshooting-kubeadm/) @@ -25,7 +23,3 @@ In this example, we will deploy Kubernetes over multiple Linux machines (physica 1. After successful initialization of the Kubernetes master, follow the kubeadm join commands output by the setup script on each agent machine 1. Execute [setup-volumes-agent.sh](setup-volumes-agent.sh/) script on each agent machine to create volumes for local storage 1. Execute ***kubectl apply -f local-storage-provisioner.yaml*** against the Kubernetes cluster to create the local storage provisioner. This will create a Storage Class named "local-storage". -1. Now, you can deploy the SQL Server 2019 big data cluster following instructions [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions). -Simply type in "local-storage" twice (once for data, once for logs) when facing the following prompt by azdata : - -`Kubernetes Storage Class - Config Path: spec.storage.data.className - Description: This indicates the name of the Kubernetes Storage Class to use. You must pre-provision the storage class and the persistent volumes or you can use a built in storage class if the platform you are deploying provides this capability. - Please provide a value:` From ab4987069d13e753d029a29cf1d5caee8b0f4f58 Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Fri, 22 Nov 2019 14:56:26 -0800 Subject: [PATCH 08/10] Addressing comments --- .../azure-arc-data-controller/README.md | 4 --- samples/features/azure-arc/README.md | 4 +++ .../deployment/README.md | 0 .../deployment/kubeadm/README.md | 0 .../kubeadm/ubuntu-single-node-vm/README.md | 2 +- .../cleanup-controller.sh | 1 - .../ubuntu-single-node-vm/setup-controller.sh | 27 +++++++------------ .../deployment/kubeadm/ubuntu/README.md | 0 .../ubuntu/local-storage-provisioner.yaml | 0 .../deployment/kubeadm/ubuntu/rbac.yaml | 0 10 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 samples/features/azure-arc-data-controller/README.md create mode 100644 samples/features/azure-arc/README.md rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/README.md (100%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/README.md (100%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/ubuntu-single-node-vm/README.md (93%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh (99%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh (87%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/ubuntu/README.md (100%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml (100%) rename samples/features/{azure-arc-data-controller => azure-arc}/deployment/kubeadm/ubuntu/rbac.yaml (100%) diff --git a/samples/features/azure-arc-data-controller/README.md b/samples/features/azure-arc-data-controller/README.md deleted file mode 100644 index 6bbbf149..00000000 --- a/samples/features/azure-arc-data-controller/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Azure Arc Data Controller cluster - -## Samples Setup -Follow the instrutions here: https://raw.githubusercontent.com/ananto-msft/sql-server-samples/master/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md diff --git a/samples/features/azure-arc/README.md b/samples/features/azure-arc/README.md new file mode 100644 index 00000000..2a171069 --- /dev/null +++ b/samples/features/azure-arc/README.md @@ -0,0 +1,4 @@ +# Azure Arc Data Controller cluster + +## __[Sample setup and deployment](deployment/)__ +This folder contains necessary instruction to setup and deploy sample Azure Arc Data Controller cluster. diff --git a/samples/features/azure-arc-data-controller/deployment/README.md b/samples/features/azure-arc/deployment/README.md similarity index 100% rename from samples/features/azure-arc-data-controller/deployment/README.md rename to samples/features/azure-arc/deployment/README.md diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/README.md b/samples/features/azure-arc/deployment/kubeadm/README.md similarity index 100% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/README.md rename to samples/features/azure-arc/deployment/kubeadm/README.md diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/README.md similarity index 93% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md rename to samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/README.md index ba028a52..d5568439 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/README.md +++ b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/README.md @@ -25,7 +25,7 @@ sudo systemctl reboot 1. Download the script on the VM you are planning to use for the deployment ``` bash -curl --output setup-controller.sh https://raw.githubusercontent.com/ananto-msft/sql-server-samples/master/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +curl --output setup-controller.sh https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh ``` 2. Make the script executable diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh similarity index 99% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh rename to samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh index ed6dc795..ec100756 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh +++ b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/cleanup-controller.sh @@ -28,7 +28,6 @@ ip link set flannel.1 down iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X rm -rf .azdata/ -rm -rf bdcdeploy/ # Remove mounts. # diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh similarity index 87% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh rename to samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index 04b59928..2d4e22b4 100644 --- a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -31,22 +31,16 @@ export AZDATA_PRIVATE_PREVIEW_DEB_PACKAGE="https://aka.ms/aadatacontrollerazdata # Kube version. # -KUBE_DPKG_VERSION=1.15.0-00 -KUBE_VERSION=1.15.0 +KUBE_DPKG_VERSION=1.16.3-00 +KUBE_VERSION=1.16.3 # Wait for 5 minutes for the cluster to be ready. # TIMEOUT=600 RETRY_INTERVAL=5 -# Github related contstants -# -GITHUB_AADATACONTROLLER_BRANCH=master - # Variables used for azdata cluster creation. # -export AZDATA_USERNAME=admin -export AZDATA_PASSWORD=$password export DOMAIN_SERVICE_ACCOUNT_USERNAME=admin export DOMAIN_SERVICE_ACCOUNT_PASSWORD=$password @@ -58,7 +52,7 @@ export MSSQL_SA_PASSWORD=$password export KNOX_PASSWORD=$password export ACCEPT_EULA=yes -export CLUSTER_NAME=mssql-cluster +export CLUSTER_NAME=azure-arc-cluster export PV_COUNT="40" # Make a directory for installing the scripts and logs. @@ -69,7 +63,7 @@ cd $AZUREARCDATACONTROLLER_DIR/ touch $LOG_FILE { -# Install all necessary packages: kuberenetes, docker, python3, python3-pip, request, azdata. +# Install all necessary packages: kuberenetes, docker, request, azdata. # echo "" echo "######################################################################################" @@ -187,9 +181,9 @@ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 -echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.conf -echo net.ipv6.conf.default.disable_ipv6=1 > /etc/sysctl.conf -echo net.ipv6.conf.lo.disable_ipv6=1 > /etc/sysctl.conf +echo net.ipv6.conf.all.disable_ipv6=1 >> /etc/sysctl.conf +echo net.ipv6.conf.default.disable_ipv6=1 >> /etc/sysctl.conf +echo net.ipv6.conf.lo.disable_ipv6=1 >> /etc/sysctl.conf sysctl net.bridge.bridge-nf-call-iptables=1 @@ -230,7 +224,7 @@ kubectl taint nodes ${master_node} node-role.kubernetes.io/master:NoSchedule- # Local storage provisioning. # -kubectl apply -f https://raw.githubusercontent.com/ananto-msft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml +kubectl apply -f https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/features/azure-arc/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml # Install the software defined network. # @@ -238,7 +232,7 @@ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documen # helm init # -kubectl apply -f https://raw.githubusercontent.com/ananto-msft/sql-server-samples/$GITHUB_AADATACONTROLLER_BRANCH/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml +kubectl apply -f https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/features/azure-arc/deployment/kubeadm/ubuntu/rbac.yaml # Verify that the cluster is ready to be used. # @@ -279,7 +273,7 @@ echo "Starting to deploy azdata cluster..." # Command to create cluster for single node cluster. # -azdata control create -c tina-kubeadm-private-preview --accept-eula $ACCEPT_EULA +azdata control create -n $CLUSTER_NAME -c azure-arc-data-kubeadm-private-preview --accept-eula $ACCEPT_EULA echo "Azure Arc Data Controller cluster created." # Setting context to cluster. @@ -289,7 +283,6 @@ kubectl config set-context --current --namespace $CLUSTER_NAME # Login and get endpoint list for the cluster. # azdata login -n $CLUSTER_NAME -azdata bdc endpoint list --output table if [ -d "$HOME/.azdata/" ]; then sudo chown -R $(id -u $SUDO_USER):$(id -g $SUDO_USER) $HOME/.azdata/ diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md b/samples/features/azure-arc/deployment/kubeadm/ubuntu/README.md similarity index 100% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/README.md rename to samples/features/azure-arc/deployment/kubeadm/ubuntu/README.md diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml b/samples/features/azure-arc/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml similarity index 100% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml rename to samples/features/azure-arc/deployment/kubeadm/ubuntu/local-storage-provisioner.yaml diff --git a/samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml b/samples/features/azure-arc/deployment/kubeadm/ubuntu/rbac.yaml similarity index 100% rename from samples/features/azure-arc-data-controller/deployment/kubeadm/ubuntu/rbac.yaml rename to samples/features/azure-arc/deployment/kubeadm/ubuntu/rbac.yaml From c36635582fc9e9c31abeb9683303639485b9388a Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Mon, 25 Nov 2019 10:59:29 -0800 Subject: [PATCH 09/10] Updating the cluster control plan namespace. --- .../kubeadm/ubuntu-single-node-vm/setup-controller.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index 2d4e22b4..501e0e16 100644 --- a/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -52,7 +52,7 @@ export MSSQL_SA_PASSWORD=$password export KNOX_PASSWORD=$password export ACCEPT_EULA=yes -export CLUSTER_NAME=azure-arc-cluster +export CLUSTER_NAME=azure-arc-system export PV_COUNT="40" # Make a directory for installing the scripts and logs. From 7c28d8a2b16106f12ff9a1b59865041f9bfe061e Mon Sep 17 00:00:00 2001 From: "Anton Antonov (TONY)" Date: Mon, 25 Nov 2019 13:08:00 -0800 Subject: [PATCH 10/10] Removign variables we don't use. --- .../kubeadm/ubuntu-single-node-vm/setup-controller.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh index 501e0e16..a0a6d0cd 100644 --- a/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh +++ b/samples/features/azure-arc/deployment/kubeadm/ubuntu-single-node-vm/setup-controller.sh @@ -41,16 +41,9 @@ RETRY_INTERVAL=5 # Variables used for azdata cluster creation. # - -export DOMAIN_SERVICE_ACCOUNT_USERNAME=admin -export DOMAIN_SERVICE_ACCOUNT_PASSWORD=$password - export CONTROLLER_USERNAME=controlleradmin export CONTROLLER_PASSWORD=$password -export MSSQL_SA_PASSWORD=$password -export KNOX_PASSWORD=$password - export ACCEPT_EULA=yes export CLUSTER_NAME=azure-arc-system export PV_COUNT="40"