Professional Documents
Culture Documents
What is Container:
Executable unit of software that encapsulate everything necessary to run dependencies and can
everywhere.
Container Runtime:
Uses of Containers:
Microservices: Loosely coupled and independently deployable services.
DevOps: Build, Ship, and Run software.
Hybrid and Multi-cloud: Run consistently across different environments.
Application modernizing and migration.
Development of a container:
Docker file serves as a blueprint for the Image and outlines the steps to build and image.
Image is a read-only file that contains everything needed to run an application. Images serve as templates
for containers.
Container is a running image which puts a Write-Layer above the read-only image.
Docker file is text file having docker instructions: FROM, ENV, ADD/COPY, RUN, CMD
Docker Steps:
1) Dockerfile
FROM ........
COPY . .
RUN ......
EXPOSE 3000
CMD ["NPM", "start"]
Question: Why do we use the FROM instruction at the top of a Docker file?
To specify a base image to build our application on top of and for all subsequent instructions to follow on
from
2) docker build.
docker-compose.yml
version: '3'
services:
app: #first service is our app
build: ./app
ports:
- "3000:3000" #bind port 3000 on local machine to port 3000 on docker
restart: always
links:
- mongo
mongo: #there is no build here since we don't have local image of DB.
image: mongo
ports:
- "27017:27017"
Kubernetes:
When number of containers becomes large, it becomes harder to manage and handle it.
1. Use the kubectl CLI
2. Create a Kubernetes Pod
3. Create a Kubernetes Deployment
4. Create a Replica Set that maintains a set number of replicas
5. Witness Kubernetes load balancing in action
Kubernetes can provide replica sets of pods. So, the container gets replicated and this provide load
balancing and fault tolerance.
A Kubernetes cluster consists of a set of worker machines, called nodes, that run
containerized applications. Every cluster has at least one worker node.
The worker node(s) host the Pods that are the components of the application. The control
plane manages the worker nodes and the Pods in the cluster.
The container runtime is the software that is responsible for running containers.
Kubernetes supports several container runtimes: Docker, containerd, CRI-O, and any
implementation of the Kubernetes CRI (Container Runtime Interface).
What is Kubernetes:
In Kubernetes, usually:
Cluster is stored on a device, many replica-sets and pods are stored on 1 device.
Replica-sets use threads for serving requests
Scale up: add new pods (...running) to serve our requests (horizontal scaling).
Scale down: terminate some pods (…terminating)
Docker image doesn't run itself but run by Kubernetes pod (or by docker run without
kubernetes)
Non-sensitive information like test, dev, and prod. Sensitive like API keys and account ids.
In .yaml file, images field is for docker image tag. Then, we apply .yaml using kubectl and then deploy.
OpenShift:
Cloud native meaning: Cloud native is an approach to building and running applications that exploits the
advantages of the cloud computing delivery model. When companies build and operate applications
using a cloud native architecture, they bring new ideas to market faster and respond sooner to customer
demands.
Kubernetes is an API.
Objectives:
Build and deploy a simple guestbook application.
IBM Watson Tone Analyzer is a service on the IBM Cloud that enables you to analyze emotions and tones
in written content
Guestbook is a simple, multi-tier web application that we will build and deploy with Docker and
Kubernetes. The application consists of a web front end, a Redis master for storage, a replicated set of
Redis slaves, and an analyzer that will analyze the tone of the comments left in the guestbook. For all of
these we will create Kubernetes Deployments, Pods, and Services.
Microservices and serverless:
Vendor lock-in is when someone is essentially forced to continue using a product or service
regardless of quality, because switching away from that product is so costly.
Serverless:
Serverless Types:
FaaS, Object Storage, Streaming and messaging, API Gateways
Faas:
Object Storage: