Professional Documents
Culture Documents
Basics - Core Concepts
Basics - Core Concepts
Basics
Container Evolution
Container Runtime Engine
Docker Basics
Creating application images and tagging
Continuous Integration with Images
Basics
Container Evolution
Containerized App -
What’s inside? - App + Library + Bin
Image - App bundled with Dependencies
Container - Image deployed as Container
Deployment differs based on env - Dev, Staging, Prod
Envs, Configurations(Port, DB), Secrets, Resource limits, etc.
Namespaces
Docker Lab
#Images and containers
docker pull nginx
=> Pulls latest version, see all versions - https://hub.docker.com/_/nginx?tab=tags
docker run --name nginx -dt -p 80:80 nginx
docker ps
docker stop nginx
docker ps
docker ps -a
docker start nginx
docker ps
docker exec -it nginx /bin/sh
docker rm nginx
Basics and Core Concepts
docker ps -a
docker images
docker rmi nginx
docker images
# Cleanup
## Containers
docker rm $(docker ps -qa)
## Images
docker image prune -a
vi app.js
process.on('SIGINT', function() {
console.log('Caught interrupt signal and will exit');
process.exit();
});
# save the file with :wq
vi Dockerfile
Docker Commands
docker build -t node-app:0.1 .
docker images
docker run -p 4000:80 --name my-app -dt node-app:0.1
curl http://localhost:4000
docker logs my-app
docker stop my-app && docker rm my-app
docker run -p 4000:80 --name my-app02 -d node-app:0.1
docker ps
docker logs [container_id]
follow the log's output as the container is running, use the -f option,
docker logs -f [container_id]
Core Concepts
Kubernetes Architecture
Master Node initialisation
Worker Nodes initialization - Worker1 & 2
Basic commands of Kubernetes
Kubernetes Architecture
Master
API Server
Scheduler
Controller Manager
Cloud Controller Manager(CCM)
Etcd
Worker
Kubelet <-> Dockerd
Kube-proxy
Pods - Containers - App running
Operator - Access API-Server for k8s calls - Create, Update, Read, Delete resources
K8s client - UI, API, CLI - kubectl
User - App users - Access App deployed in k8s
Basics and Core Concepts
Set Hostname
Master Node:
sudo hostnamectl set-hostname master.example.com
exec bash
Worker1 Node:
sudo hostnamectl set-hostname worker-node-1.example.com
exec bash
Worker2 Node:
sudo hostnamectl set-hostname worker-node-2.example.com
exec bash
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
cat ~/.kube/config
Verification:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
master.example.com Ready control-plane,master 64m v1.23.4
kubectl get ns
kubectl describe ns kube-system
kubectl api-resources
kubectl explain pod
kubectl explain pod.spec –recursive
kubectl cluster-info
kubectl cluster-info dump > cluster-dump
kubectl get node worker01
kubectl describe node worker01 | less
# Look at Status(should be FALSE), Address, Capacity, and Events