9 Create Kubernetes ACS Cluster
darrenge редактировал(а) эту страницу 2017-09-20 13:25:52 -07:00

Create a Windows Kubernetes Cluster

We will use Azure Container Service (ACS) to create a cluster on which we will run CRA workers. These instructions are adapted from the official documentation provided here. We will name our cluster cra-test. Make sure you have an Azure account and have installed Azure CLI 2.0.

  1. Open a command prompt (we prefer x64 Native Tools Command Prompt for VS 2017).

  2. Run the following to ensure you have the latest components.

    az component update
    
  3. Login to Azure and set the correct subscription

    az login
    az account set --subscription subscription_name
    
  4. Create a resource group for CRA, named cra-test-rg.

    az group create --name=cra-test-rg --location=westus
    
  5. Deploy Kubernetes. We will use one master and two agents in our deployment. Make sure that the value of your admin-password is between 8-123 characters long and must contain an uppercase character, a lowercase character, a numeric digit and a special character.

    az acs create --orchestrator-type=kubernetes --resource-group cra-test-rg 
                  --name=cra-test --dns-prefix=cra-test --agent-count=2 --generate-ssh-keys 
                  --windows --admin-username cra-admin --admin-password your_password
    

Connect to the cluster with kubectl

  1. Install kubectl if you do not have it already. We suggest using a simple path such as D:\kubectl to install kubectl, by using the --install-location parameter to use the different path, as shown below.

    mkdir D:\kubectl
    az acs kubernetes install-cli --install-location=D:\kubectl\kubectl.exe
    
  2. Add D:\kubectl to your PATH environment variable, and set D:\kubectl\config as your KUBECONFIG environment variable. Make sure you re-open the console.

  3. Download the Kubernetes cluster configuration to the local ~/.kube/config file. The downloaded config file will be in c:\users\(username)\.kube Copy the "config" file to D:\kubectl.

    az acs kubernetes get-credentials --resource-group=cra-test-rg --name=cra-test
    
  4. Try running the following command to ensure you are able to access the cluster and see the nodes.

    kubectl get nodes