Upload
others
View
24
Download
0
Embed Size (px)
Citation preview
Create Kubernetes cluster
Login to portal and select kubernetes service
On the Basics page, configure the following options:
Project details: Select an Azure Subscription, then select or create an Azure Resource group, such as
myResourceGroup.
Cluster details: Enter a Kubernetes cluster name, such as myAKSCluster. Select a Region, Kubernetes
version, and DNS name prefix for the AKS cluster.
Primary node pool: Select a VM Node size for the AKS nodes. The VM size can't be changed once an
AKS cluster has been deployed. - Select the number of nodes to deploy into the cluster. For this
quickstart, set Node count to 1. Node count can be adjusted after the cluster has been deployed.
Connect to cluster
az aks get-credentials --resource-group andromidia --name andromediakubecluster
nano azure-vote.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-vote-back
spec:
replicas: 1
selector:
matchLabels:
app: azure-vote-back
template:
metadata:
labels:
app: azure-vote-back
spec:
nodeSelector:
"beta.kubernetes.io/os": linux
containers:
- name: azure-vote-back
image: redis
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 6379
name: redis
---
apiVersion: v1
kind: Service
metadata:
name: azure-vote-back
spec:
ports:
- port: 6379
selector:
app: azure-vote-back
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-vote-front
spec:
replicas: 1
selector:
matchLabels:
app: azure-vote-front
template:
metadata:
labels:
app: azure-vote-front
spec:
nodeSelector:
"beta.kubernetes.io/os": linux
containers:
- name: azure-vote-front
image: microsoft/azure-vote-front:v1
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
env:
- name: REDIS
value: "azure-vote-back"
---
apiVersion: v1
kind: Service
metadata:
name: azure-vote-front
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: azure-vote-front
kubectl apply -f azure-vote.yaml
test
kubectl get service azure-vote-front –watch
Upgrade a cluster
To minimize disruption to running applications, AKS nodes are carefully cordoned and drained. In
this process, the following steps are performed:
The Kubernetes scheduler prevents additional pods being scheduled on a node that is to be
upgraded.
Running pods on the node are scheduled on other nodes in the cluster.
A node is created that runs the latest Kubernetes components.
When the new node is ready and joined to the cluster, the Kubernetes scheduler begins to run pods
on it.
The old node is deleted, and the next node in the cluster begins the cordon and drain process.
Use the az aks upgrade command to upgrade the AKS cluster.
using cli
az aks upgrade --resource-group myResourceGroup --name myAKSCluster --kubernetes-version
1.15.5
Confirm that the upgrade was successful using the az aks show command as follows:
Azure CLI
az aks show --resource-group myResourceGroup --name myAKSCluster --output table
Delete the cluster
az group delete --name myResourceGroup --yes --no-wait