unixadmin.free.fr Handy Unix Plumbing Tips and Tricks

10nov/19Off

Un blog sur Azure AKS en deux temps trois mouvements

Dans la zérie Fast & Dirty voila les deux commandes et demie permettant de créer un cluster kubernetes à 3 noeuds et un blog wordpress chez Azure, la différence avec K3S sur Raspberry étant le prix, car coté performance on est sensiblement égale... (petit mensonge façon avant-vente Microsoft), enfin bon, j'me comprends. :]

Intalle azure-cli et connecte-toi sur le portail.

sudo apt install azure-cli
az login -u poivrot@libertysurf.com -p ChevalBlanc

Partie Azure

az group create --name RG-KUBI --location francecentral

az aks create --resource-group RG-KUBI --name kubi-de-rouge --node-count 3 --enable-addons monitoring --generate-ssh-keys

sudo az aks install-cli

az aks get-credentials --resource-group RG-KUBI --name kubi-de-rouge

Petit check

kubectl get node
NAME                                STATUS   ROLES   AGE     VERSION
aks-agentpool-24540435-vmss000000   Ready    agent   3h44m   v1.13.12
aks-agentpool-24540435-vmss000001   Ready    agent   3h44m   v1.13.12
aks-agentpool-24540435-vmss000002   Ready    agent   3h44m   v1.13.12

Partie WordPress (by k8s)

cat <<EOF >./kustomization.yaml
secretGenerator:
- name: mysql-pass
  literals:
  - password=YOUR_PASSWORD
EOF

curl -LO https://k8s.io/examples/application/wordpress/mysql-deployment.yaml
curl -LO https://k8s.io/examples/application/wordpress/wordpress-deployment.yaml

cat <<EOF >>./kustomization.yaml
resources:
  - mysql-deployment.yaml
  - wordpress-deployment.yaml
EOF

kubectl apply -k ./

Récupère l'IP publique de wordpress et ajoute une entrée DNS pour ton blog

alias k=kubectl

k get pod
NAME                               READY   STATUS    RESTARTS   AGE
wordpress-56ccc548c9-wk44f         1/1     Running   0          3h5m
wordpress-mysql-85f5c9d5b5-l5llc   1/1     Running   0          3h5m

k get svc
NAME              TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)        AGE
kubernetes        ClusterIP      10.0.0.1       <none>         443/TCP        3h57m
wordpress         LoadBalancer   10.0.107.125   40.1.1.160   80:30337/TCP   165m
wordpress-mysql   ClusterIP      None           <none>         3306/TCP       165m

az network dns record-set a add-record -g mc_rg-kubi_kubi-de-rouge_francecentral -z a1d641f62775422fb277.francecentral.aksapp.io  -n mylife -a 40.1.1.160

Installe ton blog via l'url http://mylife.a1d641f62775422fb277.francecentral.aksapp.io/

Pour HTTPS tu peux ajouter un ingress-controller NGINX

A+ !

Remplis sous: AZURE, KUBERNETES Commentaires