Sajeetharan Sinnathurai
With over 13 years of experience in the IT industry, Sajeetharan is a Cloud Solution Architect, an enthusiast in Cloud and Opensource.He currently works at Microsoft as a Senior Program Manager in the CosmosDB team
In a nutshell
Communities
Social Developer
Recognitions
Cloud Solution Architect @Microsoft
GDE,MCT and former MVP from SL
Top stackoverflow contributor
@sajeetharan
@kokkisajee
@sajeetharan
@sajeetharan
👍A “crash course" and strictly not for Experts
👍It won’t teach you everything, But it will help you learn what you need to know to get started
👍A mixture of discussion, jokes and demo
👍Be prepared to Unmute and ask questions
and we need only 30 steps to go there!
Disclaimer: If you don't understand anything or feel bored
let's change the topic!
Story time -> Software = Shipping?
Then
@kokkisajee
Then
Now
Actual Problem
Solved!
It works on my machine
We have not changed anything
You're testing it wrong
The Problem
The solution
Images are STATELESS and IMMUTABLE
●While a container looks like a VM, it isn’t!
●A container is JUST another process on the machine
●It uses namespaces and control groups (cgroups) to provide isolation
Namespaces include network, process, user, IPC, mount, and others
●Best practice is to use a Dockerfile
●A text file that contains a script used to create an image
●Allows various commands, including:
FROM - specify the parent image (almost always the first command)
COPY - copy files from the host into the image
RUN - run a command using binaries inside the container (install services, etc.)
CMD - specify the default command (if one not specified in parent image)
Docker | Git | Description |
---|---|---|
image | repository | collection of commits |
container | clone | used for local execution |
docker hub | GitHub | popular remote server |
Docker registries hold images.
The public Docker registry is called Docker Hub.
PreRequisites
Step 1: Create a dotnet api application
Step 2: Coment out Startup.cs to run on local
az login -u <username> -p <password>
Step 3: Run the application
cd dotnet-app
dotnet run
Step 4: Visit http://localhost:5000/WeatherForecast
dotnet new webapi --name dotnet-app
// app.UseHttpsRedirection();
Step 5: create a docker image for the dotnet-app
Step 7: Build our docker image with the dockerfile.
docker build -t dotnet-app .
or use
Ctrl+Shift+P Build Image
Step 8: Once then image buit, check the image or use explorer
Ctrl + Shift + p -> Add docker files to workspace or create manually
docker images
Step 9: Run the docker image and verify it works.
docker run --rm -it -p 5000:5000 womenwhocodeapp:latest
Step 10: open localhost:5000/WeatherForecast
Step 6: Use ENV instruction to add an environment variable
ENV ASPNETCORE_URLS=http://*:5000
Kubernetes
Cuban Yeti(s)
Clustering
Clustering
Scheduling
Scaling
Deployment
Clustering
Load balancing
Fault Taulerence
A kubernetes cluster contains:
Nodes on K8S are the basic worker machine
Masters run a set of components:
Masters can be replicated, to ensure High Availability
A cluster with a failed master can still work (Nodes will execute containers) but won't be able to change/self-heal
The basic building block of K8S
You never really run Pods directly, a Controller does!
A Deployment is used to manage Pods
To be more specific:
Deployments manage ReplicaSets, which in turn are responsible for managing Pods
When you change a Deployment:
An example Deployment (yaml file)
But your apps are not reachable from outside the cluster yet...
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
Pods are mortal:
To make sure you can always reach Pods from the same group, Kubernetes uses Services
Services offer:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: k8s.io
http:
paths:
- path: /foo
backend:
serviceName: foo-service
servicePort: 80
- path: /bar
backend:
serviceName: bar-service
servicePort: 80
http://k8s.io/foo
http://k8s.io/bar
foo-service
bar-service
IngressControllers are usually implemented with reverse proxies (e.g. nginx)
ConfigMaps and Secrets
Persistent Volumes
Network and CNI
Network Policies
HELM Package Manager
RBAC
Horizontal Pod Autoscaler
Additional Controllers
The kubelet is responsible for maintaining a set of pods
High Available Design
etcd
etcd
LB
kubectl, ui, api clients
storage
log mgmt
monitoring
nodes
Q&A
Where to go from here?
By Sajeetharan Sinnathurai
Talk about AKS and Docker for beginners at Women Who Code - KL
With over 13 years of experience in the IT industry, Sajeetharan is a Cloud Solution Architect, an enthusiast in Cloud and Opensource.He currently works at Microsoft as a Senior Program Manager in the CosmosDB team