Moving From Kubernetes to OpenShift Flashcards
File updated by oc login
~/.kube/config
What is the structure of ~/.kube/config
1) Clusters (name, server, insure)
2) Contexts (server, namespace, user)
2) Users (name, token)
Command for inspecting login contexts
oc config get-contexts
Command to switch login contexts
oc config use-context
Command to create a login contexts
oc config set-context
Using kubectl CLI and the provided manifest, to create a namespace
kubectl create -f ns.yml
Using kubectl find the ingresses in a namespace
kubectl get ingresses.v1.networking.k8s.io
Using kubectl apply customization
kubectl apply -k overlays/prod
Content of kustomization.yml that changes the image tag of a deployment
In one single command display list of deployments, pods, and services
oc get deployments,pods,services
Using jq, identify the container image specified by the deployment
oc get deployment/hello -o json | jq ‘.spec.template.spec.containers[0].image’
Using jsonpath, identify the container image specified by the deployment
oc get deployment/hello -o jsonpath=’{.spec.template.spec.containers[].image}{“\n”}’
Duplicate an image in quay.io
skopeo copy \
docker://quay.io/redhattraining/versioned-hello:v1.0 \
docker://quay.io/your_account/versioned-hello:latest
Import the image from quay.io, and enable periodically scheduled imports.
oc import-image \
quay.io/your_account/versioned-hello:latest –confirm –scheduled
Add a stream trigger to a deployment
oc set triggers deployment/hello \
–from-image versioned-hello:latest -c hello