/images/avatar.png

Understand The K8S Architecture

1. k8s components architecture. Okay, it’s very easy to understand. Like above, master node is the most important. It controls the other nodes to join the cluster. Also API server is exposed outside. Through the master node, then can arrange the other nodes. 2. Practice Target: Create the k8s cluster, then deploy the application to these 2 nodes. Steps. Use kubeadm init to create the master k8s cluster, then join node1 and node2 to the cluster.

九、Deployment declarative upgrade application

1. Several ways to upgrade Let’s look at a case first, how to deal with this situation: The POD is currently using the V1 version, and now there is a V2 version, how to replace the V2 version with the V1 version? There are three ways: Delete the old version POD and replace it with the new version POD This method is more violent. It is to directly modify the configuration template of V1 to V2, and then delete the POD of V1.

八、Access POD metadata and other resources from applications

1. Downward API passing metadata To be honest, this chapter is also in the clouds, and it feels similar to the environment variable configuration. My understanding is that the Downward API is used to configure the metadata of the POD or container, and the environment variables are used to define some regular variable parameters. Downward API supports environment variables and files, which is more flexible. 2. Kubernetes API server interaction In fact, this section mainly talks about how to use the Kubernetes API.

七、ConfigMap and Secret configuration application

1. Configuration of container command line parameters Docker uses command line parameters by defining Entrypoint and CMD in Dockerfile, but there is a problem, this is packaged into the image. Let’s take a look at the difference between the two first. Entrypoint: Defines the executable program that is invoked when the container starts. CMD: Specifies the parameters passed to Entrypoint. So the usual practice is to define these two. When starting with the command line, you can use the argu of the command line to override the definition of CMD in the file.

六、Volume - mount the disk to the container

1. volume Finally waiting for you, volume, volume. It is also a very important component of kubernetes. No, it should not be said to be a component of k8s, it should be said to be a part of POD. What problem is the volume used to solve? POD is actually equivalent to a logical host, and each POD may have multiple containers. We know that these containers are actually processes equivalent to logical hosts.

五、POD service and communication

1. Service and port The service is actually easy to understand. Think about it, how do you manage a group of the same POD? Do you need to know all their IPs, and then manually configure and connect them one by one? Obviously not needed, how to solve this problem, use services, services are actually equivalent to a routing function. Look at this, there are 3 PODs on the front end, and a Backend, how to make the whole system run normally, using services.