kubectl expose <TYPE | TYPE/NAME> [Resource]

Expose a resource as a new Kubernetes service

Arguments

NameDescription
TYPE | TYPE/NAME
Resource

Options

NameDescription
--allow-missing-template-keysIf true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats
--dry-run <Strategy>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
-f, --filename <File>Filename, directory, or URL to files identifying the resource
-k, --kustomize <Kustomize Dir>Process the kustomization directory. This flag can't be used together with -f or -R
-o, --output <Output Format>Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file
--recordRecord current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists
-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory
-l, --selector <arg>Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
--template <arg>Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]
--cluster-ip <arg>ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service
--external-ip <arg>Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP
--generator <arg>The name of the API generator to use. There are 2 generators: 'service/v1' and 'service/v2'. The only difference between them is that service port in v1 is named 'default', while it is left unnamed in v2. Default is 'service/v2'
-l, --labels <arg>Labels to apply to the service created by this call
--load-balancer-ip <arg>IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific)
--name <arg>The name for the newly created object
--overrides <arg>An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field
--port <arg>The port that the service should serve on. Copied from the resource being exposed, if unspecified
--protocol <arg>The network protocol for the service to be created. Default is 'TCP'
--save-configIf true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future
--session-affinity <arg>If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'
--target-port <arg>Name or number for the port on the container that the service should direct traffic to. Optional
--type <arg>Type for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is 'ClusterIP'