We will learn:
An entity in a cluster representing a resource:
we create them using client API (kubectl, web)
The "installation script" of the application defines what the application should look like.
has a name and annotations,
The Kubernetes cluster will tell how to achieve and maintain that state.
Yaml data types: dictionary, field, string, number
Yaml is similar to JSON
Associative array:
apiVersion
- compatibility,kind
- type of object (class),metadata
- name, tags and annotations,spec
- object specification.Pod
,Deployment
,ReplicaSet
,Service
,Ingress
.We do not create this object directly but with StatefulSet
or Deployment
.
One application unit:
Pod is indivisible - all its parts run together on one node.
We declare the PODs that the application needs
Deployment can be easily scaled (instantiated or deleted).
ReplicaSet
object+------------+
| Deployment |
+------------+
|
v
+------------+
| ReplicaSet |
+------------+
|
V
+-----+
| POD |
+-----+
node
Works for any TCP protocol
A public IP address is a valuable commodity
We declare the symbolic name of the micro service
ClusterIP
: the service is visible within the cluster (it gets a virtual IP address and DNS name)NodePort
: the service will be available on each node on the specific port.LoadBalancer
: the service will be available with the help of your provider's toolsLoadBalancer
ServicePublish using LoadBalancer
+-----------+ +-------------+ +---------------+
| POD | Cluster | Service | | Load Balancer | Public
| ClusterIP | Traffic | DNS cluster | | Public IP | TCP
+-----------+ +-------------+ +---------------+
Ingress
We will publish the HTTP service
"Wrapping" reverse proxy server (nginx
,HAProxy
)
Public web server with a symbolic DNS name
Service
to a specific URL+-----------+ +-------------+ +---------------+
| POD1 | Cluster | Service 1 | | Ingress | Public
| ClusterIP | Traffic | Cluster DNS | | Public DNS | HTTPS
+-----------+ +-------------+ + --------------+
\ Ingress Rules
+-----------+ +-------------+ \__ /service1
| POD2 | Cluster | Service 2 |
| ClusterIP | Traffic | Cluster DNS | <--- /service2
+-----------+ +-------------+
The state of the application must be separate from the process
Application
Database
Object storage
Buffer memory
Just configure the application and communicate with each other.
Kubernetes allocates resources
The application "sees" only the file system
PersistentVolume
,
PersistentVolumeClaim
,
StatefulSet
,
Access to the folder is:
The object that belongs to the application
PersistentVolume
Access to a local or distributed file system
Static mapping.
Dynamic mapping.
+------------+ Binding +--------------+
| Persistent |<--------| Persistent |
| Volume | | Volume Claim |
+------------+ +--------------+
Hardware Container
(similar to Deployment
)
We declare the POD
s that the application needs
We declare the requirements of the application for bundles
StatefulSet
depends onPersistentVolume
.
POD
withReplicaSet
PersistentVolume
usingPersistentVolumeClaim
Storage
+------------------+
| PersistentVolume | LoadBalancer
+------------------+
^ P.V.Claim ^
| |
+--------------+ Port +-----------+
| POD Template |------>| Service |
| ReplicaSet | +-----------+
| StatefulSet |
+--------------+
node