Catégorie : Kubernetes (AKS)

AKS – Pulling Containers depuis Azure Container Registry (ACR)

Hello,

Nous allons voir ensemble dans cet article comment créer une Azure Container Registry (ACR) puis comment puller une image vers cette registry.

maxime@Azure:~$ az acr create --name k8smaxdemoacr --resource-group k8smaxdemo --sku Basic
{
 "adminUserEnabled": false,
 "creationDate": "2018-02-03T16:11:49.362128+00:00",
 "id": "/subscriptions/7db5e03c-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/k8smaxdemo/providers/Microsoft.ContainerRegistry/regist
ries/k8smaxdemoacr",
 "location": "eastus",
 "loginServer": "k8smaxdemoacr.azurecr.io",
 "name": "k8smaxdemoacr",
 "provisioningState": "Succeeded",
 "resourceGroup": "k8smaxdemo",
 "sku": {
 "name": "Basic",
 "tier": "Basic"
 },
 "status": null,
 "storageAccount": null,
 "tags": {},
 "type": "Microsoft.ContainerRegistry/registries"
}

docker pull microsoft/azure-vote-front:redis-v1
docker tag microsoft/azure-vote-front:redis-v1 k8smaxdemoacr.azurecr.io/microsoft/azure-vote-front:redis-v1
docker login k8smaxdemoacr.azurecr.io --username k8smaxdemoacr --password PASSWORD
docker push k8smaxdemoacr.azurecr.io/microsoft/azure-vote-front:redis-v1

Rajouter des nodes dans AKS

Salut!

Vous venez de déployer votre cluster AKS, après quelques jours vous vous apercevez qu’il vous manque des nodes. Nous allons voir ensemble comment en rajouter de manière dynamique.

Dans l’exemple ci-dessous nous partons d’un cluster qui n’a qu’un seul et unique node et nous allons lui rajouter deux autres nodes :

maxime@Azure:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
aks-nodepool1-23772193-0 Ready agent 47m v1.8.7
maxime@Azure:~$ az aks scale --resource-group=k8smaxdemo --name=myK8SCluster --node-count 3
{
 "agentPoolProfiles": [
 {
 "count": 3,
 "dnsPrefix": null,
 "fqdn": null,
 "name": "nodepool1",
 "osDiskSizeGb": null,
 "osType": "Linux",
 "ports": null,
 "storageProfile": "ManagedDisks",
 "vmSize": "Standard_D1_v2",
 "vnetSubnetId": null
 }
 ],
 "dnsPrefix": "myK8sClust-k8smaxdemo-7db5e0",
 "fqdn": "myk8sclust-k8smaxdemo-7db5e0-0d1c495b.hcp.eastus.azmk8s.io",
 "id": "/subscriptions/7db5e03c-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/k8smaxdemo/providers/Microsoft.ContainerService/managed
Clusters/myK8sCluster",
 "kubernetesVersion": "1.8.7",
 "linuxProfile": {
 "adminUsername": "azureuser",
 "ssh": {
 "publicKeys": [
 {
 "keyData": "ssh-rsa AAAABxxxxxxxxxxxxxxxxxxxxxx"
 }
 ]
 }
 },
 "location": "eastus",
 "name": "myK8sCluster",
 "provisioningState": "Succeeded",
 "resourceGroup": "k8smaxdemo",
 "servicePrincipalProfile": {
 "clientId": "e6ef7a6f-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
 "keyVaultSecretRef": null,
 "secret": null
 },
 "tags": null,
 "type": "Microsoft.ContainerService/ManagedClusters"
}

 

Mettre à jour un cluster AKS

Hello!

Dans un précédent article je vous ai présenté comment créer un cluster AKS. Nous allons maintenant voir ensemble comment mettre à jour la version de celui-ci. A ce jour, le déploiement se fait par défaut dans la version 1.7.7.

Dans un premier temps nous allons lister les versions de notre cluster qui sont supportées :

maxime@Azure:~$ az aks get-versions -g k8smaxdemo -n myK8sCluster
{
 "agentPoolProfiles": [
 {
 "kubernetesVersion": "1.7.7",
 "name": null,
 "osType": "Linux",
 "upgrades": [
 "1.8.2",
 "1.7.12",
 "1.8.1",
 "1.8.7",
 "1.7.9",
 "1.8.6"
 ]
 }
 ],
 "controlPlaneProfile": {
 "kubernetesVersion": "1.7.7",
 "name": null,
 "osType": "Linux",
 "upgrades": [
 "1.8.2",
 "1.7.12",
 "1.8.1",
 "1.8.7",
 "1.7.9",
 "1.8.6"
 ]
 },
 "id": "/subscriptions/7db5e03c-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourcegroups/k8smaxdemo/providers/Microsoft.ContainerService/managedClusters/myK8sCluster/upgradeprofiles/default",
 "name": "default",
 "resourceGroup": "k8smaxdemo",
 "type": "Microsoft.ContainerService/managedClusters/upgradeprofiles"
}

Dans l’exemple ci-dessus nous pouvons voir que la version maximum supportée par notre cluster est la version 1.8.7

maxime@Azure:~$ az aks upgrade --name myK8sCluster --resource-group k8smaxdemo --kubernetes-version 1.8.7 --yes
{ "agentPoolProfiles": [ { "count": 1,
 "dnsPrefix": null,
 "fqdn": null,
 "name": "nodepool1",
 "osDiskSizeGb": null,
 "osType": "Linux",
 "ports": null,
 "storageProfile": "ManagedDisks",
 "vmSize": "Standard_D1_v2",
 "vnetSubnetId": null
 }
 ],
 "dnsPrefix": "myK8sClust-k8smaxdemo-7db5e0",
 "fqdn": "myk8sclust-k8smaxdemo-7db5e0-2d849988.hcp.eastus.azmk8s.io",
 "id": "/subscriptions/7db5e03c-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourcegroups/k8smaxdemo/providers/Microsoft.ContainerService/managed
Clusters/myK8sCluster",
 "kubernetesVersion": "1.8.7",
 "linuxProfile": {
 "adminUsername": "azureuser",
 "ssh": {
 "publicKeys": [
 {
 "keyData": "ssh-rsa AAAABxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 }
 ]
 }
 },
 "location": "eastus",
 "name": "myK8sCluster",
 "provisioningState": "Succeeded",
 "resourceGroup": "k8smaxdemo",
 "servicePrincipalProfile": {
 "clientId": "e6ef7a6f-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
 "keyVaultSecretRef": null,
 "secret": null
 },
 "tags": null,
 "type": "Microsoft.ContainerService/ManagedClusters"
}

Nous pouvons valider que le cluster est désormais bien à jour :

maxime@Azure:~$ az aks get-versions -g k8smaxdemo -n myK8sCluster
{
 "agentPoolProfiles": [
 { "kubernetesVersion": "1.8.7", "name": null,
 "osType": "Linux",
 "upgrades": null
 }
 ],
 "controlPlaneProfile": {
 "kubernetesVersion": "1.8.7",
 "name": null,
 "osType": "Linux",
 "upgrades": null
 },
 "id": "/subscriptions/7db5e03c-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourcegroups/k8smaxdemo/providers/Microsoft.ContainerService/managed
Clusters/myK8sCluster/upgradeprofiles/default",
 "name": "default",
 "resourceGroup": "k8smaxdemo",
 "type": "Microsoft.ContainerService/managedClusters/upgradeprofiles"
}