Imagine a nondescript town where only bus service is available for travel. Sometimes, the bus gets overcrowded. Other times, there is hardly anyone in it. Privacy is non-existent, and luggage is mixed up. On bad days, the bus breaks down and brings the whole journey to a grinding halt.
Then one day, the town gets a railway station. The train has multiple cars that allow the crowd to disperse. On slow days, cars can be removed and added again in the case of a spike in passengers. A group of passengers going to a common destination can be accommodated in the same car, and if a car breaks down, a new one can be attached in its place and passengers moved into it. When needed, cars can be attached to a completely different train, along with the passengers inside. The whole train is controlled by a central unit (the engine).
You get the drift.
The train runs similarly to how Kubernetes and containers work. The train cars are the pods that exist as standalone entities and carry a piece of an application. Passengers are the containers that carry applications along with their libraries (exemplified by the luggage in our train scenario).
Multiple containers make up an application, and these containers are controlled by a central HQ called Kubernetes.
Kubernetes is a container orchestration and management system, and belongs to the cloud-native technology stack. It rests on declarative constructs, which lists out the composition of applications interaction and management. It provides flexibility, elasticity, and easier isolation of application chunks, and startups have access to Kubernetes on Oracle Cloud Infrastructure as part of Oracle for Startups.
Kubernetes, at its heart, is an open-source orchestration platform that ensures that containers are continuously running, healthy, and available. If a container dies, another container is created in its place. It provides the application portability layer.
Kubernetes architecture is composed of:
Kubernetes ensures provisioning, scalability, and HA for the application and manages the complete lifecycle of containerized applications by automating it. It sits on top of VMs and creates a cluster of servers – virtual or physical. Kubernetes accesses the image registry like Dockers to pull out an image to spin up a container, and master orchestrates and coordinates the cluster. Nodes are where the applications are run.
The greatest advantage of Kubernetes is the portability, which means a container can be deployed on any cloud. Portability prevents vendor lock-in and helps reduce the age old complaint of ‘it-works-on-my-machine.’ Development teams can also pick up whatever tools and libraries they deem necessary to build a microservice, which runs on the container and improves productivity, which is important to scaling startups.
A typical YAML deployment file would look something like this:
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-deployment
spec:
replicas: 3
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- image: "phx.ocir.io/gse00014407/firstrepo/httpd:latest"
imagePullPolicy: Always
name: httpd
ports:
- containerPort: 80
name: httpd
protocol: TCP
imagePullSecrets:
- name: ocirsecret
Oracle Cloud Infrastructure provides Kubernetes and Container Engine for Kubernetes, which is a fully-managed, scalable, and highly available cloud service. You can also choose to build your own Kubernetes setup on Oracle Cloud Infrastructure. Users can access the Container Engine for Kubernetes to define and create Kubernetes clusters using the Console and the REST API. You can then access the clusters you create using the Kubernetes command-line (kubectl), the Kubernetes Dashboard, and the Kubernetes API.