kubectl expose
NetworkingExpose resource as service
Options & Flags
Available options for this command
--portService port
--target-portContainer port
--typeService type (ClusterIP, NodePort, LoadBalancer)
Examples
Common usage examples
Create ClusterIP service
kubectl expose deployment myapp --port=80Create LoadBalancer service
kubectl expose deployment myapp --port=80 --type=LoadBalancerExpose with port mapping
kubectl expose pod mypod --port=80 --target-port=8080Notes
- Creates a service for the resource
Related Commands
You might also find these useful