Kubernetes on Azure

De Wiki Clusterlab.com.br
Revisão de 13h07min de 24 de julho de 2019 por Damato (discussão | contribs)
Ir para navegação Ir para pesquisar

Create a Cluster

#!/bin/bash 
export RESOURCEGROUP="rgname"
export CLUSTERNAME="clustername"
export SUBNETID="xxxxxxx"
export SERVICEPRINCIPALID="xxxxxxx"
export SERVICEPRINCIPALSECRET="xxxxxxx"
export TAGS="billing=it"


function UPGRADE_NODEPOOL() {
  az aks nodepool upgrade \
    --resource-group $RESOURCEGROUP \
    -n $1 \
    --kubernetes-version $2 \
    --cluster-name $CLUSTERNAME
}

function CREATE_AKS() {
  az aks create \
    -n $CLUSTERNAME \
    -g $RESOURCEGROUP \
    -l eastus2 \
    --network-plugin azure \
    --node-count 1 \
    --node-vm-size $1 \
    --node-osdisk-size 127 \
    --nodepool-name default \
    --tags $TAGS \
    --vnet-subnet-id $SUBNETID \
    --service-principal $SERVICEPRINCIPALID \
    --client-secret  $SERVICEPRINCIPALSECRET \
    --enable-vmss \
    --enable-cluster-autoscaler \
    --min-count 2 \
    --max-count 10 \
    --node-count 3
    # --network-policy calico
}

function CREATE_NOODEPOOL() {
  az aks nodepool add \
    --resource-group $RESOURCEGROUP \
    --cluster-name $CLUSTERNAME \
    --name $1 \
    --node-vm-size Standard_B4ms  \
    --node-osdisk-size 127 \
    --node-count 2 \
    --vnet-subnet-id $SUBNETID \
    --max-count 10  \
    --min-count 2 \
    --enable-cluster-autoscaler
}

CREATE_AKS Standard_B4ms
CREATE_NOODEPOOL small Standard_B4ms
UPGRADE_NODEPOOL small 1.13.7

Load Balancing

apiVersion: v1
kind: Service
metadata:
  name: internal-app
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: internal-app