Kubexperience intro session
- 1. Haggai Philip Zagury | Tikal Knowledge
Kubexperience
Sharing our Experience with K8s
The pla>orm for developers
- 2. Who we are ? - Full Stack !
Backend
Promotions only work as
well as the marketing.
DevOps
Kubernetes, SRE, I.A.C
Frontend
React, Node.js
Mobile
Android, Cross Platform
- 3. OPS
Operations Background
CM/CI/CD
~10 years practicing CI/CD
Docker Swarm
Making CI flexible
Kubernetes
Take all you know to k8s
KubeExperience
This is literally all I do 70%
of the time ;)
Group & Tech Lead
11+ years @
Configuration Management
Continuous Integration
Continuous Delivery & Deployment
Kubernetes
Monitoring
2008
Haggai Philip
Zagury
- 4. What
What is it ?
Why
Do you need it ?
Today’s Goals
Explain how we think you should prepare
yourselves for the era of distributed
systems development
How
Methodology
- 8. The Bigger Picture
of so,ware development
Containers
Universal packaging unit
Production
Anywhere
Runtime
Any OS
Code
Any Language
- 11. Why call it that ?
What
Is Kubexperience ?
kubexperience !
- 12. What we wanted to say
Anat Zayit,
Head of FullStack
Community
• kubernetes you must know it
• kubernetes for developers
• OperaZng Kubernetes
• kuberentes for microservices
Assaf Gannon,
Frontend GL
- 13. What we wanted to say
• kubernetes you must know it
• kubernetes for developers
• OperaZng Kubernetes
• kuberentes for microservicces Anat Zayit,
Head of FullStack
Community
Assaf Gannon,
Frontend GL
- 15. So What ?
✓ New cool tech from Google
✓ Everybody’s seems to be doin’ it
➡ What’s in it for us:
✓ It does this Docker thingy ;)
✓ DeclaraPve formats | Resource DefiniPons
✓ Infrastructure as Code
✓ Flexibility in CI/CD workloads (Pure pay as you go)
✴ MulP-cloud Vendor AgnosPc
✴ Self-managed + As A Service
- 16. So What ?
It’s a kubexperience !
Something that changed how we experiment, work,
operate production
- 17. How do we (you ?)
kubexperience
The How !
How
Methodology
- 18. Theory
Learn what you are
building
Practice
Do it together
Conclusion
Align -> best practice
solution
Hands-On
kubexperience is a set os session designed
as walkthroughs, taking you from Theory to
Practice something you can take with you
at the end to your playground.
- 20. ✓ 12 factor app principles
✓Micro service development
✓ Containerisation with Docker (intro 2 docker)
✓ Working with container registries
01
Docker
Promotions only work
as well as the marketing.
01
Container & Microservices
- 21. 02
✓ Running docker stacks with docker-compose
✓Compose concepts
✓Developing with production in mind
✓12 factor app best practices implementation
Microservices
Beyond the single
Microservice
Docker
Promotions only work
as well as the marketing.
01
Container & Microservices
- 22. ✓ 12 factor app principles
✓Micro service development
✓ Containerisation with Docker (intro 2 docker)
✓ Working with container registries
01
Docker
Promotions only work
as well as the marketing.
02
✓ Running docker stacks with docker-compose
✓Compose concepts
✓Developing with production in mind
✓12 factor app best practices implementation
Microservices
Beyond the single
Microservice
Container & Microservices
- 24. Standard Workloads
Working with Standard
K8s Definitions
04
Kubernetes
Understanding how k8s
works !
03
nodes key value store control plane components
Kubernetes OS
- 26. Kubernetes
Understanding how k8s
works !
03
nodes key value store control plane components
Standard Workloads
Working with Standard
K8s Resource
Definitions
04
Tasks Stateful AppsStateless apps
Kubernetes OS
- 27. ✓ Packaging application on/for k8s
✓ Helm 3 - Using helm for managing application deployment
✓ Kustomize - the new runner up package manager
✓ Application Templating
Microservices
Beyond the single
Microservice
06
K8s Apps
Taking micro services to
the application level
05
K8s - Beyond the Basics
- 28. 05
K8s Apps
Taking micro services to
the application level
06
✓Using repositories and Helm / Kustomise plugins
✓ Explore secrets management options
✓ Explore Operators / “Kubernetes addons”
✓GitOps - way & short intro
Microservices
Beyond the single
Microservice
Custom Resource Definitions Kubernetes Operators & Common extensions
K8s - Beyond the Basics
- 29. use case
Application Scaling
Replica Sets
Load Balancing
Multiple pod instances
App Proxy
proxy-Kube
Service Discovery
core-dns / kube-dns
DNS
core-dns / kube-dns
Kubernetes out of the box use cases
- 30. Develop
Docker + docker compose
Prep 4 k8s
Promotions only work as
well as the marketing.
Deploy
See our demo-app
running in k8s
Demo
2
3
1
- 32. Develop
Docker + docker compose
Prep 4 k8s
Promotions only work as
well as the marketing.
Deploy
See our demo-app
running in k8s
Demo
2
3
1
- 33. Develop
Docker + docker compose
cat << EOF > package.json
{
"name": "kubexperience-podinfo",
"version": "1.0.0",
"description": "DNS LB demo Kubexperience app",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"license": "MIT"
}
EOF
Create a package.json
A requirement for
building a node app
mkdir kubexperience-podinfo
Create a project directory
To host our little project1 2
- 34. Develop
Docker + docker compose
cat << EOF > index.js
var http = require("http");
var os = require("os");
var server = http
.createServer(function (request, response) {
response.writeHead(200, {
"Content-Type": "text/html",
});
response.end('Your hostname is: ' + os.hostname());
})
.listen(8080);
console.log("Listening on port 8080");
EOF
Create an index.js
Serve the hostname of
the container (pod)
3
- 35. Develop
Docker + docker compose
cat << EOF > Dockerfile
FROM node:14.2-alpine
RUN mkdir -p /app
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY . /app
EXPOSE 8080
CMD [ "npm", "start" ]
EOF
Create a Dockerfile
Package our application
4
Build your container
Package our application
Docker build . -t nodejs-http-demo:latest
5
Local Test
Package our application
echo "http://localhost:8080" &&
docker run --rm -p 8080:8080 nodejs-http-demo:latest
6
- 36. Develop
Docker + docker compose
Prep 4 k8s
Promotions only work as
well as the marketing.
Deploy
See our demo-app
running in k8s
Demo
2
3
1
- 37. Deploy
Docker + docker compose
Push your container
Share on Doekcer hub
docker login
docker push hagzag/nodejs-http-demo:latest
71
- 38. Deploy
Generating standard manifests
Create a deployment
Deployment = rs + pod
cat << EOF > deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: ke-podid
spec:
replicas: 1
template:
metadata:
labels:
deployment: ke-podid
spec:
containers:
- name: ke-podid
image: hagzag/nodejs-http-demo:latest
EOF
2
- 39. Deploy
Generating standard manifests
Create a service
Expose your deployment
cat << EOF > service.yaml
apiVersion: v1
kind:
metadata:
creationTimestamp: null
labels:
app: ke-podinfo
name: ke-podinfo
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: ke-podinfo
status:
loadBalancer: {}
EOF
3
- 40. Deploy
Generating standard manifests
Create a patch file
Prepare for more environment
cat <<EOF >./kustomization.yaml
namePrefix: dev-
commonLabels:
app: ke-podinfo
resources:
- deployment.yaml
- service.yaml
EOF
4
environment prefix
- 41. Develop
Docker + docker compose
Prep 4 k8s
Promotions only work as
well as the marketing.
Deploy
See our demo-app
running in k8s
Demo
2
3
1
- 42. Prep for K8s
Generating standard manifests
kubectl apply -k ./
Apply Deployment [ patch ]
Prepare for dev environment5
kustomize is a tool designed to let users
“customize raw, template-free YAML files for
mulZple purposes, leaving the original YAML
untouched and usable as is” (wording taken directly
from the kustomize GitHub repository). ... yaml to
store the instrucZons on the changes the user
wants made to a set of resources.
- 43. Prep for K8s
Generating standard manifests
kubectl delete -k ./
Cleanup Deployment
Prepare for dev environment
6
Containers
Production
Runtime
Code
- 44. Prep 4 k8s
Standard kubernetes manifests
Replicaset
Deployment
Service
Namespace
kubectl get rs
kubectl get deploy
kubectl get svc
kubectl logs <podId>
kubectl describe <podId>
kubectl get ns
Pod
- 45. Backed-in Standards
Standard kubernetes manifests
Replicaset
Deployment
Service
Namespace
kubectl get rs
kubectl get deploy
kubectl get svc
kubectl logs <podId>
kubectl describe <podId>
kubectl get ns
Pod
Application Scaling
Replica Sets
Load Balancing
Multiple pod instances
App Proxy
proxy-Kube
Service Discovery
core-dns / kibe-dns
DNS
core-dns / kibe-dns
- 46. Develop
Docker + docker compose
Prep 4 k8s
Promotions only work as
well as the marketing.
Deploy
See our demo-app
running in k8s
2
3
1
4
Kuberentes in Docker
Do everything on your laptop
You are the cloud !
- 47. Cool tool -> K8s
Generating standard manifests
kind create cluster --name kubexperience
Create a cluster with kind
create a cluster locally
kind delete cluster --name kubexperience
Cleanup Deployment
Prepare for dev environment
0
7
kubectl apply -k ./
Apply Deployment [ patch ]
Prepare for dev environment52
- 48. A cloud experience on your laptop
Generating standard manifests
kind create cluster --name kubexperience-MetalLB
Create a cluster with kind
create a cluster locally0
kubectl apply -k ./
Deploy MetalLB
So we have a load balancer provider
2