OpenShift 4 之 Idle Pod

  1. 创建被测试应用,然后查看pod数量并访问该应用。
$ oc new-project idle
$ oc new-app openshift/hello-openshift
$ oc expose svc hello-openshift
$  oc get pod
NAME                       READY   STATUS      RESTARTS   AGE
hello-openshift-1-deploy   0/1     Completed   0          5m25s
hello-openshift-1-rz4gf    1/1     Running     0          5m11s
$ curl $(oc get route hello-openshift -o template --template '{{.spec.host}}')
Hello OpenShift!
  1. 将该应用的运行的Poc数量减到“0”
$ oc idle hello-openshift
The service "idle-app/hello-openshift" has been marked as idled
The service will unidle DeploymentConfig "idle-app/hello-openshift" to 1 replicas once it receives traffic
DeploymentConfig "idle-app/hello-openshift" has been idled
$ oc get pod
NAME                       READY   STATUS        RESTARTS   AGE
hello-openshift-1-deploy   0/1     Completed     0          3m53s
  1. 再次访问该应用,确认可以访问,并且Pod数量恢复到1个。
$ curl $(oc get route hello-openshift -o template --template '{{.spec.host}}')
Hello OpenShift!
NAME                       READY   STATUS      RESTARTS   AGE
hello-openshift-1-blgzf    1/1     Running     0          32s
hello-openshift-1-deploy   0/1     Completed   0          18m
发布了54 篇原创文章 · 获赞 0 · 访问量 1108

猜你喜欢

转载自blog.csdn.net/weixin_43902588/article/details/103748020
今日推荐