Containers on Clouds

Giorgos Damaskos
presentation in repo: https://github.com/centrefordigitalhumanities/cdh-presentations/

Outline

  • Why Containers?
  • Containerized Workflow
  • Why Kubernetes?
  • What is Kubernetes?
  • Basic objects
  • Case study: knowledge-base
  • Discuss and Hangout



Why Containers?      

Over the years, people called developers started
virtualizing and containerizing applications (separation of concerns)

Containerized Workflow      

"It works on my machine"
"Then we will ship your machine to the customer"

Containers made it easy to seperate applications but managing hundreds of containers was cumbersome... Kubernetes to the rescue!

image: https://k21academy.com/docker-kubernetes/docker-and-kubernetes/

Kubernetes features     

After a container image is pushed into a registry,
Kubernetes gets into the scene.



What is Kubernetes?    

Kubernetes is a distributed container orchestration platform
for automating deployment and management of applications at scale.

Kubernetes is also
  • Open Source
  • Distributed
  • Extensible
  • Declarative
  • Resilient

image: https://tudip.com/blog-post/managing-deployments-using-kubernetes-engine/

What is Kubernetes??      


Kubernetes is the "linux kernel" of distributed systems.
*
It abstracts away the underlying infrastructure and provides a uniform interface for applications to be both deployed and consume the shared pool of resources.
*
Kubernetes runs in nodes: on cloud or on premises or on a combination.





Basic Objects


Pod: the smallest computational unit, plugs&plays container(s), ephemeral in nature
*
Deployment: manages the lifecycle of identical pods by scaling, updating, self-healing
*
ConfigMap/Secret: holds data as key-value pairs, passwords and apikeys kept secret
*
Service: provides a stable IP address and domain name for reaching a deployment
*
Namespace: groups and isolates kubernetes objects in seperate cluster spaces


Case study: knowledge-base


  • We use python mkdocs to generate a static website
  • Containerize for Docker and run in local machine
  • Make a build pipeline which pushes to a container registry
  • Deploy and see it running in Openshift Kubernetes



Dockerfile


							# First stage
							FROM python:3-alpine AS builder
							RUN pip install --upgrade pip
							RUN pip install mkdocs-material
							COPY ./docs ./docs
							COPY mkdocs-base.yml .
							COPY mkdocs-gh.yml .
							RUN mkdocs build -f mkdocs-gh.yml

							# Second stage
							FROM nginxinc/nginx-unprivileged:stable-alpine
							COPY --from=builder /site /usr/share/nginx/html
							COPY ./k8s-mirror/nginx_configuration/default.conf /etc/nginx/conf.d/default.conf
							EXPOSE 8080
						
* Puts on glasses *
Time to run some code!

Discuss and Hangout



with Stefano's words:
"ask our software engineers questions about programming, life, and everything else,
or simply work from here while enjoying free drinks and snacks"


Thank you!

Every app needs a place to run \o/

Extra info and relevant material on:
https://centrefordigitalhumanities.github.io/cdh-presentations/slides/hello-k8s-world/