This document provides an overview of Kubernetes and OpenShift for developers. It discusses Kubernetes basics like pods, deployments, services and labels. It also covers local development approaches like using Docker Compose, testcontainers and local Kubernetes clusters. Additional topics include Helm, operators, service meshes and tools for real-time changes in Kubernetes.
10. CONFIDENTIAL designator
V0000000
Pods
Basic execution unit
One or more containers (usually only one)
Unique IP address
Ephemeral, disposable
No naked pods
First things first
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: busybox
command: ['sh', '-c', 'echo
Hello Kubernetes! && sleep
3600']
10
11. CONFIDENTIAL designator
V0000000
Replica Sets
Desired number of pods
Multiple Things
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: busybox
command: ['sh', '-c', 'echo
Hello Kubernetes! && sleep
3600']
11
12. CONFIDENTIAL designator
V0000000
Deployments
Describes desired state of pods
Creates ReplicaSets
Recreate or RollingUpdate
Rollbacks
Superset of the Previous Two
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
12
13. CONFIDENTIAL designator
V0000000
Services
Exposes a set of pods to the network
Pods Together
apiVersion: v1
kind: Service
metadata:
name: the-service
spec:
selector:
app: quarkus-demo
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: NodePort
13
17. CONFIDENTIAL designator
V0000000
Remember What App Servers Were Like in 2002?
Developing for Kubernetes (and OpenShift)
17
It’s different from what you’re used to and often annoying
Essentially the same way you
have always developed
Local Dev/Remote Kubernetes
Dependent services running
in an external cluster
Local Kubernetes
Dependent services running
locally in containers
Local With Containers
18. CONFIDENTIAL designator
V0000000
Farm to Laptop
Local Dev
Remote Kubernetes
18
JUnit
Wiremock
Mockito
Jenkins
Tekton
Familiar
Fast iteration locally
Testing and integration is cumbersome
19. CONFIDENTIAL designator
V0000000
Local with Containers
Probably the Sweet Spot
docker-compose up
Test Containers
19
Reasonably familiar
Good inner loop
Not aligned with production (or integration) but a bit closer than local
Integration is more cumbersome
31. CONFIDENTIAL designator
V0000000
Stuff You Can Use Later
31
References
Kubernetes API reference docs:
https://kubernetes.io/docs/reference/generated/kubernetes-api/
Red Hat Developers (lots of great Kubernetes/OpenShift and other content)
https://developers.redhat.com/
Kubernetes Patterns: http://shop.oreilly.com/product/0636920242598.do
9 Steps to Awesome with Kubernetes (Great tutorial and workshop)
http://bit.ly/9stepsawesome
https://github.com/burrsutter/9stepsawesome
https://www.youtube.com/watch?v=ZpbXSdzp_vo&t=3239s
32. CONFIDENTIAL designator
V0000000
Stuff You Can Use Later
32
Tools
Local Development
kubectl: https://github.com/kubernetes/kubectl
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
Docker Desktop: https://www.docker.com/products/docker-desktop
Docker Compose: https://docs.docker.com/compose/
Test Containers: https://www.testcontainers.org/
33. CONFIDENTIAL designator
V0000000
Stuff You Can Use Later
33
Tools
Local Kubernetes
Minikube: https://github.com/kubernetes/minikube
Kind: https://kind.sigs.k8s.io/docs/user/quick-start/
K3S: https://k3s.io/
MicroK8s: https://microk8s.io/
Code Ready Containers: https://github.com/code-ready/crc
34. CONFIDENTIAL designator
V0000000
Stuff You Can Use Later
34
Service Mesh
Istio:: https://istio.io/
Linkerd:: https://linkerd.io/
Solo.io: https://www.solo.io/
Aspen Mesh: https://aspenmesh.io/