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
Sem resumo de edição
Linha 1: Linha 1:
=Create a Cluster=
=Create a Cluster=
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
#!/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() {
function CREATE_AKS() {
   az aks create \
   az aks create \
     -n "" \
     -n $CLUSTERNAME \
     -g "" \
     -g $RESOURCEGROUP \
     -l eastus2 \
     -l eastus2 \
     --network-plugin azure \
     --network-plugin azure \
     --node-count 1 \
     --node-count 1 \
     --node-vm-size Standard_B4ms \
     --node-vm-size $1 \
     --node-osdisk-size 127 \
     --node-osdisk-size 127 \
     --nodepool-name "default" \
     --nodepool-name default \
     --tags "" \
     --tags $TAGS \
     --vnet-subnet-id "" \
     --vnet-subnet-id $SUBNETID \
     --service-principal "" \
     --service-principal $SERVICEPRINCIPALID \
     --client-secret  "" \
     --client-secret  $SERVICEPRINCIPALSECRET \
     --enable-vmss \
     --enable-vmss \
     --enable-cluster-autoscaler \
     --enable-cluster-autoscaler \
Linha 22: Linha 39:
     # --network-policy calico
     # --network-policy calico
}
}
</syntaxhighlight>
 
=Create a node pool=
function CREATE_NOODEPOOL() {
<syntaxhighlight lang=bash>
function CREATE_NP() {
   az aks nodepool add \
   az aks nodepool add \
--resource-group "" \
    --resource-group $RESOURCEGROUP \
--cluster-name "" \
    --cluster-name $CLUSTERNAME \
--name "" \
    --name $1 \
--node-vm-size Standard_B4ms  \
    --node-vm-size Standard_B4ms  \
--node-osdisk-size 127 \
    --node-osdisk-size 127 \
--node-count 2 \
    --node-count 2 \
--vnet-subnet-id "" \
    --vnet-subnet-id $SUBNETID \
--max-count 10  \
    --max-count 10  \
--min-count 2 \
    --min-count 2 \
--enable-cluster-autoscaler
    --enable-cluster-autoscaler
}
}
CREATE_AKS Standard_B4ms
CREATE_NOODEPOOL small Standard_B4ms
UPGRADE_NODEPOOL small 1.13.7
</syntaxhighlight>
</syntaxhighlight>
=Load Balancing=
=Load Balancing=

Edição das 13h07min 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
}

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