爲何是deploymentconfig而不是Kubernetes的deploymentgit
在new-app的時候openshift直接建立了一個deploymentconfig並部署成rc,開始並不理解爲何要這麼作,後來看到下面這個命令才大概明白,緣由主要有兩點:windows
若是回滾能夠經過下面命令tomcat
oc rollback openshift-tomcat --to-version=2
若是須要在容器運行前就帶入環境變量app
oc new-app openshift-tomcat --name=openshift-tomcat --env DEPLOY_MODE=stg
帶入多個tcp
C:\minishift-1.26.1-windows-amd64>oc new-app openshift-tomcat --name=openshift-tomcat --env DEPLOY_MODE=stg SITE=sz warning: Cannot find git. Ensure that it is installed and in your path. Git is required to work with git repositories. --> Found image a4dc2a4 (6 hours old) in image stream "myproject/openshift-tomcat" under tag "latest" for "openshift-tomcat" temp.builder.openshift.io/myproject/openshift-tomcat-3:d91ff45d --------------------------------------------------------------- Platform for building and running JEE applications on Tomcat Tags: builder, tomcat * This image will be deployed in deployment config "openshift-tomcat" * Port 8080/tcp will be load balanced by service "openshift-tomcat" * Other containers can access this service through the hostname "openshift-tomcat" --> Creating resources ... deploymentconfig.apps.openshift.io "openshift-tomcat" created service "openshift-tomcat" created --> Success Application is not exposed. You can expose services to the outside world by executing one or more of the commands below: 'oc expose svc/openshift-tomcat' Run 'oc status' to view your app.
容器運行中設置環境變量ide
C:\minishift-1.26.1-windows-amd64>oc set env dc/openshift-tomcat DEPLOY_MODE="prd" deploymentconfig.apps.openshift.io/openshift-tomcat updated
列出環境變量ui
C:\minishift-1.26.1-windows-amd64>oc set env dc/openshift-tomcat --list # deploymentconfigs/openshift-tomcat, container openshift-tomcat DEPLOY_MODE=stg