Managing Application Deployments Flashcards
Tree types of probes
startup, readiness, liveness
What does readiness probe determines?
whether or not a container is ready to serve requests
What happens if an app fails readiness probe?
OpenShift removes the IP address for the container from the endpoints of all services.
What happens container fails liveness probe?
OCP kills the container and tries to redeploy it
Readiness probe config key
spec.containers.readinessprobe
Liveness probe config key
spec.containers.livenessprobe
Five options that control probes
- initialDelaySeconds
- timeoutSeconds
- periodSeconds
- successThreshold
- failureThreshold
Three protocols for probe execution
- http
- exec
- tcp socket
How do you edit deployment using the GUI
Edith the deployment YAML by going to Workloads → Deployment →
Create http readiness probe using oc
oc set probe deployment myapp –readiness –get-url=http://:8080/healthz –period=20
Create tcp liveness probe using oc
oc set probe deployment myapp –liveness –open-tcp=3306 –period=20 –timeout-seconds=1
Get help with probe creation
oc set probe –help
What is the use of DeploymentConfig?
Enables you to use additional features, such as
- Custom deployment strategies
- Lifecycle hooks (also available on Deployment)
Two types of deployment strategies
- Route based
- Deployment config based
Change deployment strategy with oc
oc patch dc/mysql –patch ‘{“spec”:{“strategy”:{“type”:”Recreate”}}}’
Continuously run “oc get pods”
watch -n 2 oc get pods
Set an env variable on a dc
oc set env dc/mysql HOOK_RETRIES=5
Start a deployment
oc rollout latest dc/name
view the history of deployments
oc rollout history dc/name
See details of a specific deployment
oc rollout history dc/name –revision=1
Retry a deployment that failed previously
oc rollout retry dc/name
scale the number of pods in a deployment
oc scale dc/name –replicas=3
Two types of events that trigger a deployment:
- Configuration change
- Image change
Set a deployment trigger for a deployment configuration
oc set triggers dc/name –from-image=myproject/origin-ruby-sample:latest -c helloworld
Deploy java app by specifying maven repo
oc new-app –as-deployment-config –name quip
–build-env MAVEN_MIRROR_URL=URL
https://github.com/user/app-deploy
Activate readiness and liveness probes for an application
oc set probe dc/quip –liveness –readiness –get-url=http://:8080/ready –initial-delay-seconds=30 –timeout-seconds=2
Assign an OCP internal name to an external service
oc create service externalname myservice –external-name myhost.example.com