Kubernetes on Azure: mudanças entre as edições

De Wiki Clusterlab.com.br
Ir para navegação Ir para pesquisar
Sem resumo de edição
Linha 53: Linha 53:
     --enable-cluster-autoscaler
     --enable-cluster-autoscaler
}
}
 
function SCALE_NODEPOOL() {
  az aks nodepool scale \
    --cluster-name $CLUSTERNAME \
    --name $1 \
    --resource-group $RESOURCEGROUP \
    --node-count $2
}
function ADD_AZURE_EXTENSIONS() {
  az extension add --name aks-preview
  az feature register --name VMSSPreview --namespace Microsoft.ContainerService
  az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/VMSSPreview')].{Name:name,State:properties.state}"
  az provider register --namespace Microsoft.ContainerService
}
ADD_AZURE_EXTENSIONS
CREATE_AKS Standard_B4ms
CREATE_AKS Standard_B4ms
CREATE_NOODEPOOL small Standard_B4ms
CREATE_NOODEPOOL small Standard_B4ms
UPGRADE_NODEPOOL small 1.13.7
UPGRADE_NODEPOOL small 1.13.7
SCALE_NODEPOOL default 0
</syntaxhighlight>
</syntaxhighlight>
=Load Balancing=
=Load Balancing=
<syntaxhighlight lang=yaml  highlight=5,6>
<syntaxhighlight lang=yaml  highlight=5,6>

Edição das 13h13min de 24 de julho de 2019

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
}
function SCALE_NODEPOOL() {
  az aks nodepool scale \
    --cluster-name $CLUSTERNAME \
    --name $1 \
    --resource-group $RESOURCEGROUP \
    --node-count $2
}
function ADD_AZURE_EXTENSIONS() {
  az extension add --name aks-preview
  az feature register --name VMSSPreview --namespace Microsoft.ContainerService
  az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/VMSSPreview')].{Name:name,State:properties.state}"
  az provider register --namespace Microsoft.ContainerService
}
ADD_AZURE_EXTENSIONS
CREATE_AKS Standard_B4ms
CREATE_NOODEPOOL small Standard_B4ms
UPGRADE_NODEPOOL small 1.13.7
SCALE_NODEPOOL default 0

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