1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:02:10 +02:00
tldr/pages/common/kubectl-expose.md
Juri Dispan 9d383ade68
*: fix typos in command names (#11730)
* *: fix typos in command names

* command name fixes in other languages

* fix incorrectly translated commands

* change incorrect file name

* qm move disk alias pages

---------

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2023-12-14 17:41:19 +05:30

716 B

kubectl expose

Expose a resource as a new Kubernetes service. More information: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#expose.

  • Create a service for a resource, which will be served from container port to node port:

kubectl expose {{resource_type}} {{resource_name}} --port={{node_port}} --target-port={{container_port}}

  • Create a service for a resource identified by a file:

kubectl expose -f {{path/to/file.yml}} --port={{node_port}} --target-port={{container_port}}

  • Create a service with a name, to serve to a node port which will be same for container port:

kubectl expose {{resource_type}} {{resource_name}} --port={{node_port}} --name={{service_name}}