Skip to content

Instantly share code, notes, and snippets.

@gitschaub
Created December 8, 2016 09:07
Show Gist options
  • Save gitschaub/51bd00476ef07b05ac33727d154b7b76 to your computer and use it in GitHub Desktop.
Save gitschaub/51bd00476ef07b05ac33727d154b7b76 to your computer and use it in GitHub Desktop.

Common Resource Kinds

  • replicationController (rc): a controller that makes a best effort to maintain a number of pods running
  • pods: groups of containers controlled by a single rc
  • service (svc): a cluster-internal VIP that is linked to a collection of pods and ports
  • route: An OpenShift construct. Externalizes services so you can reach them from remote machines

Get stuff

oc get [resource-kind]

Get more stuff

oc get [resource-kind] -o wide
oc describe [resource-kind] [resource-name]
ex: oc describe pod kube2consul-xyz1

Create stuff

oc create -f [k8s-file]
oc process -f [k8s-template] | oc create -f -

Delete stuff

oc delete -f [k8s-file]
oc process -f [k8s-template] | oc delete -f -

Look at logs

oc logs [pod-name] 
ex: oc logs kube2consul-xyz1
oc logs [pod-name] -c [container-name]
ex: oc logs samplemicroservice-controller-xyz1 -c samplemicroservice

Some cheats

Get Container Name by Service

CONT=[service-name]; oc get pods | grep ^${CONT}-1- | cut -f1 -d" "
ex: CONT=logstash; oc get pods | grep ^${CONT}-1- | cut -f1 -d" "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment