kubectl-expose
Expose a resource as a new Kubernetes service. tldr-pages
On several platforms
Several platforms
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_portIdentify--portThe port that the service should serve on. kubectl reference--target-portName or number for the port on the container that the service should direct traffic to. kubectl referenceCreate a service for a resource identified by a file
kubectl expose --filename path/to/file.yml --port node_port --target-port container_portIdentify--filenameFilename, directory, or URL to files identifying the resource to expose a service kubectl reference--portThe port that the service should serve on. kubectl reference--target-portName or number for the port on the container that the service should direct traffic to. kubectl referenceCreate 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_nameIdentify--portThe port that the service should serve on. kubectl reference--nameThe name for the newly created object. kubectl reference