Skip to content

Instantly share code, notes, and snippets.

@carbonin
Last active December 11, 2018 18:51
Show Gist options
  • Select an option

  • Save carbonin/01b0b7694308b3ff00642400a76a5e50 to your computer and use it in GitHub Desktop.

Select an option

Save carbonin/01b0b7694308b3ff00642400a76a5e50 to your computer and use it in GitHub Desktop.
Definitions:
Containers - Lightweight mechanisms for isolating running processes so that they are limited to interacting with only their designated resources.
Pods - One or more containers deployed together on one node. The smallest compute unit that can be defined, deployed, and managed.
- Containers in a pod share the same filesystem, networking, and memory space.
- Components which are mutually dependent and scale in lock-step may be good candidates for a multi-container pod.
- Examples include proxies and log management
Labels - Key value pairs used to identify most objects (e.g. app: topological-inventory)
Selectors - Reference to labels used to group and identify objects
Deployment Configs - The definition of a pod, the number of replicas, deployment triggers, and lifecycle hooks. Pods belong to a deployment config and are related through labels and selectors.
- For example, a pod with the label `name: database` would be recognized as a replica of a deployment config with a selector entry of `name: database`
Services - Load balancer with an internal IP address and DNS record which proxies traffic to pods. Uses a selector to identify pods to route traffic to. Accessible throughout the cluster.
Routes - Externally accessible endpoint with a hostname which exposes a service. Only supports http(s) traffic.
Persistent Volume - Cluster scoped resource (not specific to a namespace) which defines access to storage to be used by pods. Created and managed by cluster admins.
Persistent Volume Claim - Request to utilize a persistent volume of a particular size.
Secrets - Storage for sensitive information which can be exposed to pods as environment variables or mounted into a pod as a file.
Config Maps - Object used to store configuration file contents, environment variables, or any static, but persistent data. Typically mounted into a pod under a directory as one or more files.
Build Configs - Defines a build process for new images. Contains where to find source artifacts and when to trigger new builds.
Image Streams - Stores information about available images and tags. Can reference the integrated registry or an external registry.
Projects - Namespace for most entities. Also allows for RBAC.
Templates - Paramaterized definition of multiple objects. Can be stored as an instantiatable entity on the server or can be processed locally into a list of objects.
Command Line Quick Reference:
Log into a cluster:
oc login <openshift-api-hostname>:8443
Projects:
oc new-project <project-name> - start a new project
oc project <project-name> - change projects
oc project - show the current project and server in use
Showing resources:
oc get all - show most resources in the current namespace
oc get pods - show all running pods
oc get dc - show all deployment configs
oc get svc - show all services
oc get pvc - show all persistent volume claims
Details:
oc describe pod <pod-name> - show all the information about a pod
oc describe dc <deployment-config-name> - show all the information about a deployment config
oc logs <pod-name> - show logs for a particular pod (accepts `-f` to follow the logs)
oc rsh <pod-name> - connect to a pod using a remote shell session
Scaling:
oc scale dc <deployment-config-name> --replicas=<num>
Creating resources:
oc apply -f <resource-file>
oc new-app --template=<template-name> -pPARAM=value
oc process -f <template-file> --param-file=<param-file> | oc apply -f -
Editing resources:
oc edit dc <deployment-config-name>
Documentation: https://docs.openshift.com/container-platform/3.11/welcome/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment