OpenShift 1 Flashcards
Kubernetes main resource types
POD (po)
Persistent Volumes (pv)
Persistent Volume Claims (pvc)
Build Config (bc)
Deployment / deployment Confg (dc)
Services (svc)
Config Maps (cm)
Secrets
Login to OCP cluster using CLI
oc login -u user1 -p passwd URL
Forward port to mysql server
oc port-forward mysql 3306:3306
Deploy mysql using template
oc new-app
- -template=mysql-persistent
- p MYSQL_USER=user1
- p MYSQL_PASSWORD=mypa55
- p MYSQL_DATABASE=testdb
- p MYSQL_ROOT_PASSWORD=r00tpa55
- p VOLUME_CAPACITY=10Gi
Deploy mysql using image from registry
oc new-app –image=myregistry.com/mycompany/myapp –name=myapp
Deploy app using github url
oc new-app https://github.com/openshift/ruby-hello-world –name=ruby-hello
Deploy mysql using mysql image
oc new-app mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql
Get list of pv
oc get pv
Create pv
oc create -f pvc.yaml
get certain resources
oc get RESOURCE_TYPE RESOURCE_NAME
Show detailed of the resource
oc describe resource_type resource_name
oc create
oc create
edit resource
oc edit deploymentconfig/parksmap-katacoda
Delete resource
oc delete RESOURCE_TYPE name
Search by label
oc get svc,deployments -l app=nexus
Create a route
oc expose svc quotedb –name quote
oc expose object_type object_name
Restart an OCP build
oc start-build myapp
Create an app with s2i
oc new-app -i php http://services.lab.example.com/app –name=myapp
Get list of image streams for a specific project.
oc get is -n openshift
Get list of builds
oc get builds
Get list of bc
oc get buildconfig
Get list of templates inside a project where you are not currently
oc get templates -n openshift
Explain: oc process –parameters mysql-persistent -n openshift
list available parameters/resources from a template
Process a template and redirect output to a file
oc process -o yaml -f filename > myapp.yaml
Which OCP resource is responsible for the build step in the S2I process
BuildConfig (BC)
How do you retrieve logs resulting from the S2I build step?
oc logs bc/appname
How do you retrieve logs resulting from the S2I deployment step?
oc logs -f deployment/appname
How do you troubleshoot volume issues in OCP?
1) Delete the persistent volume claim
2) Delete the persistent volume.
3) Recreate the persistent volume
Delete persistent volume
oc delete pv
Monitor logs from a build
oc logs -f bc/temps
Flag to configure oc new-app to create a DeploymentConfig resource instead of a Deployment
–as-deployment-config
Flag to provide the image stream to be used
–image-stream
-i
Flag to specify if deployment is docker or pipeline or source
–strategy