oc loginoc apply -foc getoc new-appoc exposepodman run doesn't scale.| Component | Responsibility |
|---|---|
| API server | The front door: every oc command and console action goes through it |
| etcd | The database that stores the cluster's state |
| Scheduler | Chooses which node each new pod runs on |
| Controller manager | Runs the loops that make actual state match desired state |
Those run on control plane nodes. Worker nodes run the application pods. OpenShift adds a web console, an image registry, and its own controllers.
| Resource | Purpose |
|---|---|
| Pod | The smallest deployable unit: one or more co-located containers |
| Deployment | Manages replicas of a pod, and rolls out new versions |
| Service | A stable internal address that load-balances across matching pods |
| Route (OpenShift) | Exposes a Service outside the cluster, under a host name |
| ConfigMap / Secret | External configuration / sensitive data |
DeploymentConfig, OpenShift's older equivalent of a Deployment. It's deprecated; use Deployments.# deployment.yaml (excerpt)
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysite
spec:
replicas: 2
selector:
matchLabels:
app: mysite
template:
metadata:
labels:
app: mysite
spec:
containers:
- name: mysite
image: quay.io/myorg/mysite:1.0
ports:
- containerPort: 8080
$ oc apply -f deployment.yaml
$ oc get deployment mysite # READY 2/2 $ oc delete pod mysite-7d9c6-abcde # simulate a failure $ oc get pods # a replacement is already starting $ oc scale deployment/mysite --replicas=3
# A Service gives the pods one stable internal address $ oc expose deployment mysite --port=8080 # A Route makes that Service reachable from outside the cluster $ oc expose service mysite $ oc get route mysite # Or create a TLS-terminated route instead $ oc create route edge mysite-tls --service=mysite
S2I builds a runnable image from your source code plus a builder image, with no Containerfile needed.
$ oc new-app https://github.com/example/mysite.git --name=mysite $ oc get pods $ oc expose service mysite $ oc get route mysite
oc new-app detects the language, runs an S2I build, then creates the Deployment and Service.
oc can do.oc get route before debugging the app.replicas field guarantee, and how does the cluster enforce it?oc new-app against a Git repository using S2I?