openshift¶
This content pack provides pieces to build Openshift clusters.
Troubleshooting commands¶
oc get nodes oc get pods oc get clusteroperators oc get clusteroperator monitoring oc get events -n openshift-authentication --sort-by='.metadata.creationTimestamp' oc get multiclusterhub -n open-cluster-management oc describe multiclusterhub multiclusterhub -n open-cluster-management oc adm top nodes
oc get clusterversion oc describe clusterversion
Upgrading¶
oc adm upgrade --to=4.15.36
Testing OpenShift¶
Deploy a test hello application¶
The following assumes a configured KUBECONFIG
.
# Create a new project
oc new-project hello-openshift
# Create the deployment
kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.43 -- /agnhost serve-hostname
# Inspect the app to verify the port:
oc get pods
oc rsh deployment/hello-node netstat -tlnp
# Expose the correct port
oc expose deployment hello-node --port=9376
# Expose the service
oc expose service hello-node
# Find the route
oc get route hello-node -n hello-openshift
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
hello-node hello-node-hello-openshift.apps.asdf.k8s.local hello-node 9376 None
# Verify the route works
curl hello-node-hello-openshift.apps.asdf.k8s.local
hello-node-8dd54cb99-bq5q5
# Scale the deployment
oc scale deployment hello-node --replicas=3
oc get pods
for i in {1..10}; do printf "%s\n" $(curl -s hello-node-hello-openshift.apps.asdf.k8s.local); sleep 1; done
# Cleanup
# Delete the deployment
oc delete deployment hello-node
# Delete the service
oc delete service hello-node
# Delete the route
oc delete route hello-node
# Delete the project
oc delete project hello-openshift
Ideas¶
- Status Event,
drpcli events post
- Cron trigger