OC-SET-PROBE(1)
π oc set probe β the glow-up your pod templates deserve β¨
Okay so bestie, welcome to oc set probe from the oc set family (OpenShift CLI, June 2016 energy but make it iconic πΈ). This is the page where we learn how to add or yeet liveness, readiness, and startup probes from a pod or pod template. It's giving health check main character energy and honestly? Obsessed. π«Ά
π SYNOPSIS
oc set probe [OPTIONS]
That's it. That's the whole vibe check. π
β¨ DESCRIPTION β¨
So like, this command sets or removes a liveness, readiness, or startup probe from a pod or pod template. Periodt. π
Every container in a pod can define one or more probes, and those probes are literally the whole general health checking situation. Let me break down the three types for you bestie, because this is important:
- Liveness probe β checked periodically to make sure the container is still healthy. If it fails? The container gets restarted. No cap, it's that serious. π
- Readiness probe β sets or clears the ready flag for each container. This controls whether the container's ports are included in the list of endpoints for a service, and whether a deployment can proceed. Your readiness check should indicate when your container is ready to accept incoming traffic or begin handling work. Lowkey the most underrated one tbh.
- Startup probe β gives your container some extra startup time before the liveness probe even starts. It's like a little grace period π§.
Setting both liveness and readiness probes for each container is highly recommended. Not me begging you to do this. π
The three probe types (as in, what they actually do) are:
- Open a TCP socket on the pod IP
- Perform an HTTP GET against a URL on a container that must return
200 OK - Run a command in the container that must return exit code
0
Containers that take a variable amount of time to start should set generous initial-delay-seconds values. Otherwise, as your application evolves, you may suddenly begin to fail. That's the warning, bestie, and it's giving "learn from my mistakes" energy π.
π οΈ OPTIONS π οΈ
Every single flag, preserved for the culture. Slay. π
--all=falseβ Iftrue, select all resources in the namespace of the specified resource types.--allow-missing-template-keys=trueβ Iftrue, ignore any errors in templates when a field or map key is missing in the template. Only applies togolangandjsonpathoutput formats.-c,--containers="*"β The names of containers in the selected pod templates to change. May use wildcards, so go wild π«.--dry-run="none"β Must be"none","server", or"client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. It's a vibe check before the real thing.--failure-threshold=0β The number of failures before the probe is considered to have failed.--field-manager="kubectl-set"β Name of the manager used to track field ownership.-f,--filename=[]β Filename, directory, or URL to files to use to edit the resource.--get-url=""β A URL to perform an HTTP GET on. You can omit the host, have a string port, or omit the scheme. Flexible queen π .--initial-delay-seconds=0β The time in seconds to wait before the probe begins checking.-k,--kustomize=""β Process the kustomization directory. This flag can't be used together with-for-R. Not me warning you twice. π«Ά--liveness=falseβ Set or remove a liveness probe to verify this container is running.--local=falseβ Iftrue, set image will NOT contact api-server but run locally.--open-tcp=""β A port number or port name to attempt to open via TCP.-o,--output=""β Output format. One of: (json,yaml,kyaml,name,go-template,go-template-file,template,templatefile,jsonpath,jsonpath-as-json,jsonpath-file).--period-seconds=0β The time in seconds between attempts.--readiness=falseβ Set or remove a readiness probe to indicate when this container should receive traffic.-R,--recursive=falseβ Process the directory used in-f,--filenamerecursively. Useful when you want to manage related manifests organized within the same directory. Big "organized bestie" energy β¨.--remove=falseβ Iftrue, remove the specified probe(s).-l,--selector=""β Selector (label query) to filter on.--show-managed-fields=falseβ Iftrue, keep themanagedFieldswhen printing objects in JSON or YAML format.--startup=falseβ Set or remove a startup probe to verify this container is running.--success-threshold=0β The number of successes required before the probe is considered successful.--template=""β Template string or path to template file to use when-o=go-template,-o=go-template-file. The template format is golang templates β the docs are athttp://golang.org/pkg/text/template/#pkg-overview.--timeout-seconds=0β The time in seconds to wait before considering the probe to have failed.
ποΈ OPTIONS INHERITED FROM PARENT COMMANDS ποΈ
These are the family heirlooms, passed down from the parent command. Respect the lineage. π
--as=""β Username to impersonate for the operation. User could be a regular user or a service account in a namespace.--as-group=[]β Group to impersonate for the operation. This flag can be repeated to specify multiple groups.--as-uid=""β UID to impersonate for the operation.--as-user-extra=[]β User extras to impersonate for the operation. This flag can be repeated to specify multiple values for the same key.--cache-dir="/homeless-shelter/.kube/cache"β Default cache directory.--certificate-authority=""β Path to a cert file for the certificate authority.--client-certificate=""β Path to a client certificate file for TLS.--client-key=""β Path to a client key file for TLS.--cluster=""β The name of the kubeconfig cluster to use.--context=""β The name of the kubeconfig context to use.--disable-compression=falseβ Iftrue, opt-out of response compression for all requests to the server.--insecure-skip-tls-verify=falseβ Iftrue, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. Fr, be careful with this one π¬.--kubeconfig=""β Path to the kubeconfig file to use for CLI requests.--kuberc=""β Path to thekubercfile to use for preferences. This can be disabled by exportingKUBECTL_KUBERC=falsefeature gate or turning off the featureKUBERC=off.--match-server-version=falseβ Require server version to match client version.-n,--namespace=""β If present, the namespace scope for this CLI request.--profile="none"β Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex).--profile-output="profile.pprof"β Name of the file to write the profile to.--request-timeout="0"β The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g.1s,2m,3h). A value of zero means don't timeout requests.-s,--server=""β The address and port of the Kubernetes API server.--tls-server-name=""β Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used.--token=""β Bearer token for authentication to the API server.--user=""β The name of the kubeconfig user to use.--warnings-as-errors=falseβ Treat warnings received from the server as errors and exit with a non-zero exit code.
πΈ EXAMPLE πΈ
These examples are iconic, bestie. Copy them exactly, no edits, I'm watching you. π
# Clear both readiness and liveness probes off all containers
oc set probe dc/myapp --remove --readiness --liveness
# Set an exec action as a liveness probe to run 'echo ok'
oc set probe dc/myapp --liveness -- echo ok
# Set a readiness probe to try to open a TCP socket on 3306
oc set probe rc/mysql --readiness --open-tcp=3306
# Set an HTTP startup probe for port 8080 and path /healthz over HTTP on the pod IP
oc set probe dc/webapp --startup --get-url=http://:8080/healthz
# Set an HTTP readiness probe for port 8080 and path /healthz over HTTP on the pod IP
oc set probe dc/webapp --readiness --get-url=http://:8080/healthz
# Set an HTTP readiness probe over HTTPS on 127.0.0.1 for a hostNetwork pod
oc set probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats
# Set only the initial-delay-seconds field on all deployments
oc set probe dc --all --readiness --initial-delay-seconds=30
The way that last one sets only the initial-delay-seconds field on all deploymentsβ¦ minimal, elegant, iconic. π
π SEE ALSO π
Go check it out, bestie, it's like the mothership command. πΈ
π HISTORY π
June 2016, Ported from the Kubernetes man-doc generator. Vintage, honestly. π
Sign-off time π«Ά β this lil page is part of the Openshift CLI User Manuals from Openshift, dated June 2016. Stan a classic manual, bestie. Now go set those probes and slay β¨π
π¦ where this page comes from
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms