Skip to content

Latest commit

 

History

History
149 lines (119 loc) · 2.97 KB

File metadata and controls

149 lines (119 loc) · 2.97 KB

4. Explain network concepts for applications in AKS

How to check connectivity during network lab

kubectl run -i -t busybox-curl --image=yauritux/busybox-curl --restart=Never
curl -v <ip>:<port>

Deploy AKS with CNI

  1. Deploy virtual network
az network vnet create -g aks02-XX -n vnet --address-prefix 172.16.0.0/16 \
    --subnet-name aks \
    --subnet-prefix 172.16.0.0/24
  1. Get the subnet resource ID for the existing subnet into which the AKS cluster will be joined.
az network vnet subnet list \
    --resource-group aks02-XX \
    --vnet-name vnet \
    --query [].id --output tsv
  1. Deploy AKS with CNI
az aks create -g aks02-XX -n aks02 --kubernetes-version 1.12.5 \
    --network-plugin azure \
    --vnet-subnet-id <subnet-id> \
    --docker-bridge-address 172.17.0.1/16 \
    --dns-service-ip 10.2.0.10 \
    --service-cidr 10.2.0.0/24
  1. Get access to cluster and verify the pods
az aks get-credentials -g aks02-XX -n aks02 --admin
kubectl get pods --all-namespaces -o wide

Expose Kubernetes service

  1. Create demo application.
kubectl apply -f kuard.yaml
  1. Expose demo application with public IP.
apiVersion: v1
kind: Service
metadata:
  name: kuard
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  selector:
    app: kuard
kubectl apply -f lb.yaml
  1. Check public ip of service.
kubectl get svc --all-namespaces -o wide
  1. Expose demo application with internal IP.
apiVersion: v1
kind: Service
metadata:
  name: kuard-internal
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  selector:
    app: kuard
kubectl apply -f ilb.yaml
  1. Check internal ip of service.
kubectl get svc --all-namespaces -o wide
  1. Expose demo application with static internal IP.
apiVersion: v1
kind: Service
metadata:
  name: kuard-internal
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  loadBalancerIP: 172.16.0.240
  selector:
    app: kuard
kubectl apply -f ilb-fix-ip.yaml
  1. Check internal ip of service.
kubectl get svc --all-namespaces -o wide

Links: