Update cheatsheets

This commit is contained in:
ivuorinen
2024-02-21 11:19:49 +00:00
parent 4e88a1b42f
commit 3d653cc7e6
4803 changed files with 127002 additions and 0 deletions

21
kubectl-expose Normal file
View File

@@ -0,0 +1,21 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# 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}}`