Kubernetes pod creation process

We know that kubernetes consists of many different components

In the first case, if you directly create a pod
apiVersion: v1
kind: Pod
metadata:
  name: demo
  namespace: lizhe
spec:
  containers:
  - name: demo-ctr
    image: nginx

  • Kubectl sends a request to create a pod to the API server
  • API server generates pod creation information
  • API server stores creation information to etcd
  • The scheduler queries the pod Spec.node = = null confirm that this pod is not allocated
  • The scheduler allocates node pod Spec.node = node1, save to etcd
  • Kubelet queries etcd and operates on the node

In the second case, create a pod through deploy (replicaset)

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
  • Kubectl sends a request to create a dep to the API server
  • API server generates dep creation information
  • API server stores creation information to etcd
  • Replicaset in controller manager the controller obtains replicaset information from etcd
  • The controller manager sends a request to create three pods to the API server
  • API server generates pod creation information
  • API server stores creation information to etcd
  • The scheduler queries the pod Spec.node = = null confirm that this pod is not allocated
  • The scheduler allocates node pod Spec.node = node1, save to etcd
  • Kubelet queries etcd and operates on the node

In fact, only the above steps are extra

Send a Message