download: Kubernetes entry to advanced combat
K8s, the de facto standard for container orchestration, the strategic focus of enterprise technology in the cloud-native era, is also a necessary skill for future back-end development, operation and maintenance. But K8s contains many complicated technical points, and it is not easy to learn. This course will provide a learning route that is easier to master K8s systematically, so that everyone can learn easily and thoroughly.
Technical requirements Developers and operation and maintenance engineers who
have a certain server-side basic knowledge and basic linux commands
interested in the container field
Environmental parameters
Virtualbox 6
Centos 7
Docker 1.19
Kubernetes 1.19.3
Chapter 1 Curriculum Guidance Trial
This chapter is introduced as the course content. It mainly introduces the actual projects of the course, the learning methods of the course, and the detailed arrangement of the course content. I hope everyone can pass this course and learn something.
A total of 2 sessions (10 minutes) Collapse list
1-1 Must read before class
1-2 Course introduction and study guide (09:12) Try to read
the project preparation of Chapter 2 Pre-class preparation. Try
this chapter to let everyone understand the course knowledge, clarify the Kubernetes knowledge system, and implement the actual combat. The process of packaging and containerized operation of the blog project of the course lays a solid foundation for subsequent learning.
A total of 8 sessions (52 minutes) Collapse list
2-1 Kubernetes knowledge system (06:02)
2-2 Introduction to the actual blog project (05:05)
2-3 Blog project architecture and central code (06:21)
2-4 Blog application operation environment construction (03:08 )
2-5 Virtualbox virtual machine configuration with dual network cards to complete a fixed IP (13:09) Take a look at
2-6 Installation Docker & environment configuration (09:46)
2-7 Docker running Mysql Server (05:31)
2-8 Blog project compilation Package operation (02:44)
Chapter 3 Docker of Kubernetes must know that you must
learn Kubernetes well. Containers are the prerequisite. This chapter will take you to quickly get started with Docker containers based on commands and principles, and actually run blog applications on containers, as a follow-up to the course Mirror pull to pave the way.
A total of 7 sessions (73 minutes) Collapse list
3-1 Why Docker is needed (12:35)
3-2 Docker namespace isolation (09:50)
3-3 CGroups completes resource quota (12:31)
3-4 Docker image characteristics & principles (12:46)
3-5 Write a Dockerfile for the blog project (07:17)
3-6 Build a Docker image for the blog project (07:30)
3-7 Docker run -link to run the blog project (09:47)
Chapter 4 Kubernetes Foundation and Cluster Construction Try
this chapter Everyone analyzes the origin of Kubernetes, analyzes the Kubernetes architecture layer by layer, and uses kubeadm to build an Artifactory cluster from scratch.
A total of 10 sessions (90 minutes) Collapse list
4-1 The source and development of Kuberentes (06:18)
4-2 Why Kubernetes is needed (06:27)
Take a look at 4-3 Kubernetes architecture and central concepts (
07:03 ) 4-4 Kubernetes deployment plan (04:06)
4-5 Device basic software (13:42)
4-6 Master node device kubeadm (03:46)
4-7 Initialize Kubernetes Master (08:11)
4-8 Device configuration worker node node (11:07)
4-9 Analyze the process of Kubeadm installation and troubleshoot errors (18:55)
4-10 Installation Dashboard (09:30)
Chapter 5 Kubernetes' scheduling unit Pod
This chapter starts with the Pod composition principle, life cycle, handling and other aspects to take everyone to control winding Kubernetes Pod, the central component of Kubernetes, actually how to run applications on Kubernetes in Pod mode.
A total of 14 sessions (106 minutes) Collapse list
5-1 Create Nginx Pod (04:50)
5-2 Pod completion principle (07:26)
5-3 Container and Pod life cycle (06:39)
5-4 Provide handling for container life cycle (06:17 )
5-5 Create a Pod containing an Init container (08:05)
5-6 Use a probe to check the health of the Pod (06:31)
5-7 Set the command and parameters to be executed when the container is started (07:55)
5-8 Define mutually dependent environment variables
for the container (08:19) 5-9 Stop quota management for the container (06:03)
5-10 Install the second worker node (09:57)
5-11 Use affinity scheduling Node (07:55)
5-12 Inject configmap data into the container (06:28)
5-13 Root vs privileged user (06:51)
5-14 Non-root user running Pod (12:09)
Chapter 6 Kubernetes Network After finishing
running the Pod, this chapter takes you to control how to allow external users to access the resources of the Pod, and how to use Service and Ingress.
A total of 7 sessions (62 minutes) Collapse list
6-1 Service Object & Theory (06:57)
6-2 Expose Pod Service Address with Service (11:30)
6-3 Pod Communication Mechanism in the Cluster (06:14)
6-4 Theoretical Service Creates DNS Record (10 :34)
6-5 Access Service from outside the cluster (08:09)
6-6
Ingress theory (10:05) 6-7 Actual Ingress Controller (08:20)
Chapter 7 Kubernetes Controller
This chapter will take you to control Kubernetes A variety of controllers manage the life cycle of Pod, understand how Daemon Pods are scheduled, and finally combat Job tasks.
A total of 6 sessions (55 minutes) Collapse list
7-1 ReplicaSet management copy (09:15)
7-2 Deepen understanding of deployment (09:47)
7-3 Stateful applications StatefulSets (11:05)
7-4 DeamonSet background tasks (10:16)
7-5 Daemoset How to schedule (06:24)
7-6 Job task combat (07:47)
Chapter 8 Kubernetes Durable Storage Business Data
This chapter takes you to control how to manage a stateful application, and how to durable stateful data, and combat PV , PVC mounts NFS.
Chapter 9 The Application and Configuration of
Kubernetes This chapter will combat Configmap and Secret key management, and will also bring you the best theory for controlling Kubernetes configuration management.
Chapter 10: Container Mirroring Center of Kubernetes
This chapter will take you to a deeper understanding of the private container mirroring center, configure the private mirroring center, and complete the image packaging and uploading of blog applications.
Chapter 11 Deploying Blog Project in Kubernetes
This chapter will deploy a complete blog application to Kubernetes, configure the Mysql database of the stateful set, and complete the distance and mirror upgrade.
Chapter 12 Use Helm to Deploy Applications
This chapter will let everyone understand Helm, complete Helm installation, deploy Helm Chart, create private Helm and create Helm chart for blog projects, and finally complete the combined deployment of applications and databases.
Chapter 13 Use Prometheus and Grafana to complete Kubernetes monitoring.
After deploying the application in the previous chapter, this chapter brings you the Yunyuan birthday monitoring platform Prometheus, uses Prometheus to monitor Kubernetes clusters, and completes the deployment and configuration of Grafana.
Chapter 14 Extension of Kubernetes
This chapter will help you advance Kubernetes, extend the Kubernetes platform, and complete custom functions.
Chapter 15 Course Summary
This chapter is the last chapter of the course. We will take you to sort out the content of the course as a whole, and provide some follow-up learning suggestions. The teachers in the course Q&A area are waiting for further communication with you.
本课程持續更新中
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.SortedSet; import java.util.Set; import java.util.NavigableSet; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.util.Collections; import java.io.InputStream; /* Built using CHelper plug-in Actual solution is at the top / public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskH solver = new TaskH(); solver.solve(1, in, out); out.close(); } static class TaskH { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); int len = in.nextInt(); int[] x = new int[n]; int[] y = new int[n]; double[] s = new double[n]; for (int i = 0; i < n; ++i) { x[i] = in.nextInt(); y[i] = in.nextInt(); s[i] = in.nextDouble(); } List<TaskH.Segment> segments = new ArrayList<>(); int pos = 0; for (int i = 0; i < n; ++i) { if (x[i] > pos) { segments.add(new TaskH.Segment(pos, x[i], 0.0)); } segments.add(new TaskH.Segment(x[i], y[i], s[i])); pos = y[i]; } if (pos < len) { segments.add(new TaskH.Segment(pos, len, 0.0)); } out.println(solveOne(segments)); } private double solveOne(List<TaskH.Segment> segments) { int n = segments.size(); for (int i = 0; i < n; ++i) { TaskH.Segment s = segments.get(i); s.ptr = i; s.curEnergy = 0.0; s.maxEnergy = (s.right - s.left) / s.s; s.minEnergy = -(s.right - s.left) / (s.s + 2); } List<TaskH.Segment> segmentsByS = new ArrayList<>(segments); Collections.sort(segmentsByS, new Comparator<TaskH.Segment>() { public int compare(TaskH.Segment o1, TaskH.Segment o2) { int z = Double.compare(o2.s, o1.s); if (z == 0) { z = Integer.compare(o2.left, o1.left); } return z; } }); TreeSet<TaskH.Segment> available = new TreeSet<>(new Comparator<TaskH.Segment>() { public int compare(TaskH.Segment o1, TaskH.Segment o2) { return o1.ptr - o2.ptr; } }); available.addAll(segments); for (TaskH.Segment s : segmentsByS) { if (s.s == 0.0) break; s.alive = false; available.remove(s); NavigableSet<TaskH.Segment> after = available.tailSet(s, false); double capacity = s.maxEnergy - s.curEnergy; double spent = 0.0; while (!after.isEmpty()) { TaskH.Segment t = after.first(); if (t.alive) { double t1 = t.curEnergy - t.minEnergy; double t2 = capacity - spent; double transfer = Math.min(t1, t2); spent += transfer; t.curEnergy -= transfer; if (t1 <= t2) { available.remove(t); } else { break; } } } s.curEnergy += spent; } double res = 0.0; for (TaskH.Segment s : segments) { double v = (s.right - s.left - s.curEnergy * s.s) / (s.right - s.left + s.curEnergy); res += (s.right - s.left) / (s.s + v); } return res; } static class Segment { int left; int right; int ptr; double s; boolean alive = true; double minEnergy; double curEnergy; double maxEnergy; public Segment(int left, int right, double s) { this.left = left; this.right = right; this.s = s; } } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } } }