Kubernetes
Kubernetes
------------------------
There are two primary components of Kubernetes Architecture: the master node and
the worker node
Kube-apiserver --- The API server is the front end for the Kubernetes control
plane.
etcd --- key value store
kubescheduler -- Control plane component that watches for newly created Pods with
no assigned node, and selects a node for them to run on.
kube controller manager -- Logically, each controller is a separate process, but to
reduce complexity,
they are all compiled into a single binary and run in a
single process
Node controller, Job controller, replicaset controller
Kubelet -- An agent that runs on each node in the cluster. It makes sure that
containers are running in a Pod.
kube-proxy - kube-proxy is a network proxy that runs on each node in your cluster,
implementing part of the Kubernetes Service concept.
Container runtime -- The container runtime is the software that is responsible for
running containers.
What is Kubernetes?
--------------------
What is orchestration
----------------------
Orchestration refers to the integration of multiple services that allows them to
automate processes or synchronize information
in a timely fashion. Say, for example, you have six or seven microservices for an
application to run.
If you place them in separate containers, this would inevitably create obstacles
for communication. Orchestration would help in
such a situation by enabling all services in individual containers to work
seamlessly to accomplish a single goal.
Cluster IP service
Node Port service -- It opens a specific port on all Nodes and forwards any traffic
sent to this port to the service.
External Name Creation service and
Load Balancer service - The LoadBalancer service is used to expose services to the
internet.
A Network load balancer, for example, creates a single IP
address that forwards all traffic to your service.
Ingress network
---------------------
This is an API object that provides the routing rules to manage the external users
access to the services in the Kubernetes cluster
through HTTPS/ HTTP. With this, users can easily set up the rules for routing
traffic without creating a bunch of load balancers
or exposing each service to the nodes.
headless service
-----------------
Istio is an open source service mesh that layers transparently onto existing
distributed applications.
Istio has two components: the data plane and the control plane.
-------------------------
The data plane is the communication between services. Without a service mesh, the
network doesn’t
understand the traffic being sent over, and can’t make any decisions based on what
type of traffic it is, or who it is from or to.
The control plane takes your desired configuration, and its view of the services,
and dynamically
programs the proxy servers, updating them as the rules or the environment changes.
An Envoy proxy is deployed along with each service that you start in your cluster,
or runs alongside services running on VMs.
--------------------
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
--------------------------
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /testpath
backend:
serviceName: test
servicePort: 80
--------------------------
Docker K8
========================
Imperative:
----------
apiVersion: v1
kind: Service
metadata:
labels:
app: frontend
name: frontend-svc
spec:
ports:
- port: 3000
protocol: TCP
targetPort: 3000
selector:
app: frontend
type: ClusterIP