Skip to content

Commit 513f691

Browse files
bashlogsgitbook-bot
authored andcommitted
GITBOOK-2: No subject
1 parent d3428e2 commit 513f691

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2419
-53
lines changed

.gitbook/assets/5643187419873280.png

113 KB
Loading

.gitbook/assets/image (1).png

-235 KB
Loading

.gitbook/assets/image (2).png

-1.35 MB
Loading

.gitbook/assets/image (3).png

5.29 KB
Loading

.gitbook/assets/image (4).png

-1.07 MB
Loading

.gitbook/assets/image (5).png

-496 KB
Loading

.gitbook/assets/image (6).png

-626 KB
Loading

.gitbook/assets/image (7).png

2.09 KB
Loading

.gitbook/assets/image.png

-122 KB
Loading

README.md

+34-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
11
---
2-
description: Tools we are going to use in this course
2+
cover: .gitbook/assets/5643187419873280.png
3+
coverY: 0
4+
layout:
5+
cover:
6+
visible: true
7+
size: hero
8+
title:
9+
visible: true
10+
description:
11+
visible: true
12+
tableOfContents:
13+
visible: true
14+
outline:
15+
visible: true
16+
pagination:
17+
visible: true
318
---
419

5-
# Tools
20+
# 👋 Welcome to Kubernetes
621

7-
## Open Source Kubernetes platform 
22+
{% hint style="info" %}
23+
**About this page:** The page summarizes Kubernetes architecture and applications, including components like nodes, API server, scheduler, and its versatility in deployments.
24+
{% endhint %}
825

9-
To learn about kubernetes in depth
1026

11-
{% embed url="https://collabnix.github.io/kubelabs/" fullWidth="false" %}
1227

13-
## Where and how to run kubernetes ?
28+
### Check the pre-requisites and go for the Kubernetes.
1429

15-
### AWS and Google Cloud ( Paid / Billing)
30+
{% content-ref url="pre-requirements.md" %}
31+
[pre-requirements.md](pre-requirements.md)
32+
{% endcontent-ref %}
1633

17-
You have to create instances to run cluster in aws and cloud. Chance of getting bills.
1834

19-
### Katacoda ( Free / Temporary )
2035

21-
It is a free service but it's cluster gets deleted after few minutes.
36+
### Different way to install cluster on your system.
2237

23-
### Minikube ( Free )
38+
{% content-ref url="broken-reference" %}
39+
[Broken link](broken-reference)
40+
{% endcontent-ref %}
2441

25-
It's let you create cluster on your local machine. Easy to learn from scratch.
2642

27-
{% embed url="https://minikube.sigs.k8s.io/docs/handbook/controls/" %}
43+
44+
### Kubernetes Architecture
45+
46+
{% content-ref url="broken-reference" %}
47+
[Broken link](broken-reference)
48+
{% endcontent-ref %}
2849

SUMMARY.md

+75-40
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,77 @@
11
# Table of contents
22

3-
* [Tools](README.md)
4-
* [Index](index.md)
5-
* [Source / Documentation](source-documentation.md)
6-
* [Kubernetes for Beginners](kubernetes-for-beginners/README.md)
7-
* [What is containers ?](kubernetes-for-beginners/what-is-containers.md)
8-
* [What is container orchestration ?](kubernetes-for-beginners/what-is-container-orchestration.md)
9-
* [What is Kubernetes ?](kubernetes-for-beginners/what-is-kubernetes.md)
10-
* [What is Cluster ?](kubernetes-for-beginners/what-is-cluster/README.md)
11-
* [Pod](kubernetes-for-beginners/what-is-cluster/pod.md)
12-
* [Node / Worker Node](kubernetes-for-beginners/what-is-cluster/node-worker-node.md)
13-
* [Kubernetes Master](kubernetes-for-beginners/what-is-cluster/kubernetes-master.md)
14-
* [Kubernetes Services](kubernetes-for-beginners/what-is-cluster/kubernetes-services.md)
15-
* [What is kubectl ?](kubernetes-for-beginners/what-is-kubectl.md)
16-
* [Kubernetes Access Control](kubernetes-for-beginners/kubernetes-access-control.md)
17-
* [Practical with minikube](practical-with-minikube/README.md)
18-
* [Installation](practical-with-minikube/installation.md)
19-
* [Cluster Setup](practical-with-minikube/cluster-setup.md)
20-
* [Minikube commands](practical-with-minikube/minikube-commands.md)
21-
* [Deployment](practical-with-minikube/deployment.md)
22-
* [Kubernetes Dashboard](practical-with-minikube/kubernetes-dashboard.md)
23-
* [YAML File](practical-with-minikube/yaml-file.md)
24-
* [Container Runtime](practical-with-minikube/container-runtime.md)
25-
* [Volume Management](practical-with-minikube/volume-management.md)
26-
* [Config Maps and Secrets](practical-with-minikube/config-maps-and-secrets.md)
27-
* [Kubernetes for Developers](kubernetes-for-developers/README.md)
28-
* [Kubernetes Architecture](kubernetes-for-developers/kubernetes-architecture.md)
29-
* [The Borg Heritage](kubernetes-for-developers/the-borg-heritage.md)
30-
* [Practical - 2](practical-2/README.md)
31-
* [Kubernetes Installation in AWS](practical-2/kubernetes-installation-in-aws.md)
32-
* [Build](practical-2/build.md)
33-
* [Temp Bookmarks](temp-bookmarks.md)
34-
* [NFS Server](nfs-server.md)
35-
36-
## Troubleshooting
37-
38-
* [Basic Troubleshooting](troubleshooting/basic-troubleshooting.md)
39-
40-
## Group 1
41-
42-
* [Other Things](group-1/other-things.md)
3+
* [👋 Welcome to Kubernetes](README.md)
4+
* [📚 Pre-Requirements](pre-requirements.md)
5+
6+
## Cluster Setup
7+
8+
* [Kubectl](cluster-setup/kubectl.md)
9+
* [Minikube](cluster-setup/minikube.md)
10+
* [K3s](cluster-setup/k3s.md)
11+
12+
## Architecture
13+
14+
* [What is Kubernetes](architecture/what-is-kubernetes.md)
15+
* [The Borg Heritage](architecture/the-borg-heritage.md)
16+
* [Kubernetes Arch.](architecture/kubernetes-arch..md)
17+
* [Containers](architecture/containers.md)
18+
* [Pods](architecture/pods.md)
19+
* [Services](architecture/services.md)
20+
* [Deployment](architecture/deployment.md)
21+
22+
## Build
23+
24+
* [Containerizion](build/containerizion.md)
25+
* [Dockerfile](build/dockerfile.md)
26+
* [Deployment](build/deployment.md)
27+
* [Multi-Container Pod](build/multi-container-pod.md)
28+
29+
## Design
30+
31+
* [Resources Management](design/resources-management.md)
32+
* [Label and Selector](design/label-and-selector.md)
33+
* [Jobs and CronJobs](design/jobs-and-cronjobs.md)
34+
35+
## Deployments
36+
37+
* [Basic Commands](deployments/basic-commands.md)
38+
* [Storage configs](deployments/storage-configs/README.md)
39+
* [Volumes](deployments/storage-configs/volumes.md)
40+
* [Volume Types](deployments/storage-configs/volume-types.md)
41+
* [PVC and PV](deployments/storage-configs/pvc-and-pv.md)
42+
* [Config Maps](deployments/config-maps.md)
43+
44+
## 🔐 Security
45+
46+
* [Accessing the API](security/accessing-the-api/README.md)
47+
* [Authentication](security/accessing-the-api/authentication.md)
48+
* [Authorization](security/accessing-the-api/authorization.md)
49+
* [Admission Controller](security/accessing-the-api/admission-controller.md)
50+
* [Security Contest](security/security-contest/README.md)
51+
* [Pod Security Policies](security/security-contest/pod-security-policies.md)
52+
* [Pod Security Standard](security/security-contest/pod-security-standard.md)
53+
* [Network Policies](security/network-policies/README.md)
54+
* [Example](security/network-policies/example.md)
55+
* [Practical](security/practical/README.md)
56+
* [Security Context](security/practical/security-context.md)
57+
* [Create / Consume Secrets](security/practical/create-consume-secrets.md)
58+
* [Service Account](security/practical/service-account.md)
59+
* [Network Policies](security/practical/network-policies.md)
60+
* [Test Policy](security/practical/test-policy.md)
61+
* [Assignment](security/practical/assignment.md)
62+
63+
## Services
64+
65+
* [Service Types](services/service-types/README.md)
66+
* [Cluster IP](services/service-types/cluster-ip.md)
67+
* [NodePort](services/service-types/nodeport.md)
68+
* [LoadBalancer](services/service-types/loadbalancer.md)
69+
* [Container Commands](services/container-commands.md)
70+
* [Ingress Resources](services/ingress-resources.md)
71+
72+
## Others
73+
74+
* [NFS Server](others/nfs-server.md)
75+
* [Shortcut](others/shortcut.md)
76+
* [Podman](others/podman.md)
77+
* [Overall Architecture](others/overall-architecture.md)

architecture/containers.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Containers
2+
3+
There are many competing organizations working with containers. As an orchestration tool, Kubernetes is being developed to work with many of them, with the overall community moving toward open standards and easy interoperability. 
4+
5+
The early and strong presence of Docker meant that historically, this was not the focus. As Docker evolved, spreading their vendor-lock characteristics through the container creation and deployment life cycle, new projects and features have become popular. 
6+
7+
As other container engines become mature, Kubernetes continues to become more open and independent.
8+
9+
10+
11+
## Container Runtime Interface
12+
13+
The goal of the Container Runtime Interface (CRI) is to allow easy integration of container runtimes with kubelet. By providing a protobuf method for API, specifications and libraries, new runtimes can easily be integrated without needing deep understanding of kubelet internals.
14+
15+
16+
17+
## Types of Containers
18+
19+
### 1. Containerd
20+
21+
The intent of the containerd project is not to build a user-facing tool; instead, it is focused on exposing highly-decoupled low-level primitives. Because of it modularity and low overhead, large cloud providers use this engine. User facing tools such as crictl, ctr, and nerdctl are being further developed.
22+
23+
* ​Defaults to runC to run containers according to the OCI Specifications
24+
* Intended to be embedded into larger systems
25+
* Minimal CLI, focused on debugging and development.
26+
27+
### 2. CRI-O
28+
29+
This project is currently in incubation as part of Kubernetes. It uses the Kubernetes Container Runtime Interface with OCI-compatible runtimes, thus the name [CRI-O](https://github.com/cri-o/cri-o). Currently, there is support for runC (default) and Clear Containers, but a stated goal of the project is to work with any OCI-compliant runtime.
30+
31+
### 3. Docker
32+
33+
Launched in 2013
34+
35+
Docker made containerizing, deploying, and consuming applications easy. As a result, it became the default option in production. With an open registry of images, 
36+
37+
[Docker Hub](https://hub.docker.com/), you can download and deploy vendor or individual-created images on multiple architectures with a single and easy to use toolset. 
38+
39+
This ease meant it was the sensible default choice for any developer as well. Issues with rapid updates and interaction with stakeholders lead to major vendors moving away from Docker soon after it became part of Mirantis.
40+
41+
### 4. rkt
42+
43+
The rkt runtime, pronounced rocket, provides a CLI for running containers. Announced by CoreOS in 2014, it is now part of the Cloud Native Computing Foundation family of projects. 
44+
45+
Learning from early Docker issues, it is focused on being more secure, open and interoperable. Many of its features have been met by Docker improvements. 
46+
47+
It is not quite an easy drop-in replacement for Docker, but progress has been made. rkt uses the appc specification, and can run Docker, appc and OCI images. It deploys immutable pods.
48+
49+
50+
51+
52+

architecture/deployment.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Deployment
2+
3+
A Deployment provides declarative updates for Pods and ReplicaSets.
4+
5+
You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.
6+
7+
8+
9+
## Creating a Deployment
10+
11+
{% code title="app.yaml" %}
12+
```yaml
13+
apiVersion: apps/v1
14+
kind: Deployment
15+
metadata:
16+
name: nginx-deployment
17+
labels:
18+
app: nginx
19+
spec:
20+
replicas: 3
21+
selector:
22+
matchLabels:
23+
app: nginx
24+
template:
25+
metadata:
26+
labels:
27+
app: nginx
28+
spec:
29+
containers:
30+
- name: nginx
31+
image: nginx:1.14.2
32+
ports:
33+
- containerPort: 80
34+
```
35+
{% endcode %}
36+
37+
```
38+
kubectl create -f app.yaml
39+
```
40+
41+
### Get the deployments
42+
43+
```
44+
kubectl get deployment
45+
```
46+
47+
### Scale the Deployment
48+
49+
```
50+
kubectl scale deployment nginx --replicas=4
51+
```
52+
53+
### Delete the deployments
54+
55+
```
56+
kubectl delete deployment nginx
57+
```

architecture/kubernetes-arch..md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Kubernetes Arch.
2+
3+
<figure><img src="../.gitbook/assets/image (4).png" alt=""><figcaption></figcaption></figure>
4+
5+
In its simplest form, Kubernetes is made of one or more central managers (aka masters) and worker nodes. The manager runs an API server, a scheduler, various operators and a datastore to keep the state of the cluster, container settings, and the networking configuration.
6+
7+
Kubernetes exposes an API via the API server. you can communicate with the API using a local client called kubectl or you can write your own client. The kube-scheduler sees the API requests for running a new container and finds a suitable node to run that container.&#x20;
8+
9+
Each node in the cluster runs two components: kubelet and kube-proxy. The kubelet systemd service receives spec information for container configuration, downloads and manages any necessary resources and works with the container engine on the local node to ensure the container runs or is restarted upon failure. The kube-proxy pod creates and manages local firewall rules and networking configuration to expose containers on the network.
10+
11+
12+
13+
## Control Plane Nodes
14+
15+
The Kubernetes master runs various server and manager processes for the cluster. Among the components of the master node are the kube-apiserver, the kube-scheduler, and the etcd database. As the software has matured, new components have been created to handle dedicated needs, such as the cloud-controller-manager; it handles tasks once handled by the kube-controller-manager to interact with other tools, such as Rancher or DigitalOcean for third-party cluster management and reporting.
16+
17+
### 1. Kube-apiserver
18+
19+
All calls, both internal and external traffic, are handled via this agent. All actions are accepted and validated by this agent, and it is the only agent which connects to the etcd database. As a result, it acts as a master process for the entire cluster, and acts as a frontend of the cluster's shared state. Each API call goes through three steps: authentication, authorization, and several admission controllers.
20+
21+
### 2. Kube Scheduler
22+
23+
The kube-scheduler uses an algorithm to determine which node will host a Pod of containers. The scheduler will try to view available resources (such as available CPU) to bind, and then assign the Pod based on availability and success. The scheduler uses pod-count by default, but complex configuration is often done if cluster-wide metrics are collected.
24+
25+
### 3. etcd Database
26+
27+
The state of the cluster, networking, and other persistent information is kept in an etcd database, or, more accurately, a _b+tree_ key-value store. Rather than finding and changing an entry, values are always appended to the end. Previous copies of the data are then marked for future removal by a compaction process. It works with curl and other HTTP libraries, and provides reliable watch queries.
28+
29+
### 4. Kube Controller Manager
30+
31+
The kube-controller-manager is a core control loop daemon which interacts with the kube-apiserver to determine the state of the cluster. If the state does not match, the manager will contact the necessary controller to match the desired state. There are several controllers in use, such as endpoints, namespace, and replication. The full list has expanded as Kubernetes has matured.
32+
33+
34+
35+
## Worker Node
36+
37+
All worker nodes run the kubelet and kube-proxy, as well as the container engine, such as containerd or cri-o. Other management daemons are deployed to watch these agents or provide services not yet included with Kubernetes.
38+
39+
### Kubelet
40+
41+
The kubelet interacts with the underlying Docker Engine also installed on all the nodes, and makes sure that the containers that need to run are actually running. The kubelet agent is the heavy lifter for changes and configuration on worker nodes. It accepts the API calls for Pod specifications (a PodSpec is a JSON or YAML file that describes a Pod). It will work to configure the local node until the specification has been met.
42+
43+
### Kube-proxy
44+
45+
The kube-proxy is in charge of managing the network connectivity to the containers. It does so through the use of iptables entries. It also has the userspace mode, in which it monitors Services and Endpoints using a random high-number port to proxy traffic. Use of ipvs can be enabled, with the expectation it will become the default, replacing iptables.

architecture/pods.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Pods
2+
3+
The whole point of Kubernetes is to orchestrate the life cycle of a container. We do not interact with particular containers. Instead, the smallest unit we can work with is a [Pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/).
4+
5+
A Pod is similar to a set of containers with shared namespaces and shared filesystem volumes.
6+
7+
Pods in a Kubernetes cluster are used in two main ways:
8+
9+
* **Pods that run a single container**. The "one-container-per-Pod" model is the most common Kubernetes use case; in this case, you can think of a Pod as a wrapper around a single container; Kubernetes manages Pods rather than managing the containers directly.
10+
* **Pods that run multiple containers that need to work together**. A Pod can encapsulate an application composed of [multiple co-located containers](https://kubernetes.io/docs/concepts/workloads/pods/#how-pods-manage-multiple-containers) that are tightly coupled and need to share resources. These co-located containers form a single cohesive unit.
11+
12+
Grouping multiple co-located and co-managed containers in a single Pod is a relatively advanced use case. You should use this pattern only in specific instances in which your containers are tightly coupled.
13+
14+
### Run the pod using command
15+
16+
```
17+
kubectl run newpod --image=nginx --generator=run-pod/v1
18+
```
19+
20+
### Run the pod using a file
21+
22+
{% code title="simple-pod.yaml" %}
23+
```yaml
24+
apiVersion: v1
25+
kind: Pod
26+
metadata:
27+
name: nginx
28+
spec:
29+
containers:
30+
- name: nginx
31+
image: nginx:1.14.2
32+
ports:
33+
- containerPort: 80
34+
```
35+
{% endcode %}
36+
37+
```
38+
kubectl apply -f simple-pod.yaml
39+
```
40+
41+
### To view pods
42+
43+
```
44+
kubectl get pods
45+
kubectl get pods -o wide
46+
```

0 commit comments

Comments
 (0)