Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pod resource management of K8s and creation of Harbor private image repository (including images)

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Pod is the smallest unit of K8s management.

There are multiple containers in pod, but there is only one container in real production environment

Features:

1. Minimum deployment unit

two。 A collection of containers

3. A container in Pod shares the network command space

4.Pod is short-lived

Pod Container Classification: 1:infrastructure container basic Container (transparent process, user unaware)

Maintain the entire Pod cyberspace

Node node operation`View the container's network` [root@node1 ~] # cat / opt/kubernetes/cfg/kubeletKUBELET_OPTS= "--logtostderr=true\-- vroom4\-- hostname-override=192.168.18.148\-- kubeconfig=/opt/kubernetes/cfg/kubelet.kubeconfig\-- bootstrap-kubeconfig=/opt/kubernetes/cfg/bootstrap.kubeconfig\-- config=/opt/kubernetes/cfg/kubelet.config\-- cert-dir=/opt/kubernetes/ssl\-- pod-infra-container-image=registry.cn -hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0 "# prompt that the network component image will be downloaded from Ali Cloud. `it will be created every time a Pod is created. Corresponding to Pod, it is transparent to users of `[root@node1 ~] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES. Omitting multiple lines here 54d9e6ec3c02 registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0 "/ pause" # network components will be automatically loaded as a component to provide `Conclusion: when the basic container is created, it must create a network container `2:initcontainers initialization container.

When pod is created, the initialization initcontainers must be performed. In the old version, there is no distinction between before and after execution (the smaller the number of PID number is, the higher the priority is, and the more it is started first). With the improvement of the cloud platform, the startup mode is changed to host mode, and the separated initialization containers will be loaded first, and only after the initialization containers have been loaded can the business containers continue to run normally.

3:container business container (parallel startup)

Official website: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/

Example: Init containers in use

This example defines a simple Pod that has two init containers. The first waits for myservice, and the second waits for mydb. Once both init containers complete, the Pod runs the app container from its spec section.

ApiVersion: v1kind: Podmetadata: name: myapp-pod labels: app: myappspec: containers:-name: myapp-container image: busybox:1.28 command: ['sh','-cations, 'echo The app is running! & & sleep 3600'] initContainers:-name: init-myservice image: busybox:1.28 command: [' sh','- caches, 'until nslookup myservice; do echo waiting for myservice; sleep 2; done ']-name: init-mydb image: busybox:1.28 command: [' sh','- centering, 'until nslookup mydb; do echo waiting for mydb; sleep 2; done;'] Image pull policy (image PullPolicy)

IfNotPresent: default value, which is pulled only when the image does not exist on the host

Always: every time you create a Pod, you will pull the image again.

Never:Pod will never actively pull this image.

Official website: https://kubernetes.io/docs/concepts/containers/images

Example:

Verify by creating a pod that uses a private image, e.g.:

Kubectl apply-f-

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report