当前位置:首页 > Web开发 > 正文

192.168 . 132.132 Failed to pull image " nginx:1.4 " : rpc

2024-03-31 Web开发

标签:

一 Deployment相对付RC的优势

RS与Deployment主要用于替代RC。RS的全称为Replica Set。相对付RC,RS与Deployment的优势如下:

RC只撑持基于等式的selector,如env=dev或者environment!=qa。但在RS中,还撑持新的基于调集的selector,如version in (v1.0,v2.0)或者env not in (dev,qa)。这给庞大的运维打点带来便利

使用Deployment升级Pod只需要界说Pod的最终状态,k8s会为你执行须要的操纵。虽然使用kubectl rolling-update也可以完成滚动升级,但它是在客户端与处事端多次交互控制RC完成的,所以REST API中并没有rolling-update的接口,这为定制本身的打点系统带来了一些麻烦。Deployment拥有越发灵活的升级、回滚成果。

Replica Set目前与RC的区别只是撑持的selector差别,后续会插手更多的成果。Deployment使用了Replica Set,是更高一层的观点。除非需要自界说升级成果或者根柢不需要升级Pod,否则还是建议使用Deployment而不直接使用Replica Set。

二 Deployment是简单使用 2.1 同时安置三个nginx pod

[[email protected] manifests]# cd /yamls/

[[email protected] yamls]# mkdir deployment

[[email protected] yamls]# cd deployment

[[email protected] deployment]# vim nginx-deployment.yaml

apiVersion: apps/v1 kind: Deployment metadata: name: hello-deployment namespace: default spec: replicas: 3 selector: matchLabels: name: hello-deployment strategy: type: RollingUpdate rollingUpdate: maxSurge: 10% maxUnavailable: 0 template: metadata: labels: name: hello-deployment spec: containers: - name: webserver image: nginx:1.4 ports: - containerPort: 80

[[email protected] deployment]# kubectl apply -f nginx-deployment.yaml

2.2 检察

[[email protected] deployment]# kubectl get pods

NAME READY STATUS RESTARTS AGE goproxy 1/1 Running 0 126m hello-deployment-c6fb6d858-9g5pq 0/1 ErrImagePull 0 11s hello-deployment-c6fb6d858-qnnld 0/1 ErrImagePull 0 11s hello-deployment-c6fb6d858-v549m 0/1 ErrImagePull 0 11s init-demo 1/1 Running 0 68m nginx 2/2 Running 4 4h13m nginx-volume 1/1 Running 0 88m

[[email protected] deployment]# kubectl get pods -o wide

NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES goproxy 1/1 Running 0 126m 10.244.1.8 192.168.132.132 <none> <none> hello-deployment-c6fb6d858-9g5pq 0/1 ImagePullBackOff 0 21s 10.244.2.11 192.168.132.133 <none> <none> hello-deployment-c6fb6d858-qnnld 0/1 ImagePullBackOff 0 21s 10.244.1.12 192.168.132.132 <none> <none> hello-deployment-c6fb6d858-v549m 0/1 ImagePullBackOff 0 21s 10.244.1.13 192.168.132.132 <none> <none> init-demo 1/1 Running 0 68m 10.244.1.10 192.168.132.132 <none> <none> nginx 2/2 Running 4 4h14m 10.244.2.10 192.168.132.133 <none> <none> nginx-volume 1/1 Running 0 89m 10.244.1.9 192.168.132.132 <none> <none>

[[email protected] deployment]# kubectl describle pods  hello-deployment-c6fb6d858-v549m

Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled <unknown> default-scheduler Successfully assigned default/hello-deployment-c6fb6d858-v549m to 192.168.132.132 Normal Pulling 4m36s (x4 over 6m20s) kubelet, 192.168.132.132 Pulling image "nginx:1.4" Warning Failed 4m32s (x4 over 6m12s) kubelet, 192.168.132.132 Failed to pull image "nginx:1.4": rpc error: code = Unknown desc = Error response from daemon: manifest for nginx:1.4 not found: manifest unknown: manifest unknown Warning Failed 4m32s (x4 over 6m12s) kubelet, 192.168.132.132 Error: ErrImagePull Warning Failed 4m8s (x7 over 6m11s) kubelet, 192.168.132.132 Error: ImagePullBackOff Normal BackOff 74s (x19 over 6m11s) kubelet, 192.168.132.132 Back-off pulling image "nginx:1.4"

是nginx:1.4没有这个镜像

2.3 滚动更新

改削为1.14版本,就会本身更新

滚动更新计谋

1 先删后起

2 先起后删

[[email protected] deployment]#  kubectl apply -f nginx-deployment.yaml 

[[email protected] deployment]# kubectl get pods -o wide

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31613.html