Kubectl expose: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 7: | Line 7: | ||
<tt>expose</tt> dynamically exposes a resource (pod, service, replicationcontroller, deployment, replicaset) as a new service. The default service type is [[Kubernetes_Service_Concepts#ClusterIP|ClusterIP]], other type ([[Kubernetes_Service_Concepts#NodePort|NodePort]], [[Kubernetes_Service_Concepts#LoadBalancer|LoadBalancer]], or [[Kubernetes_Service_Concepts#ExternalName|ExternalName]]) can be specified with --type. | <tt>expose</tt> dynamically exposes a resource (pod, service, replicationcontroller, deployment, replicaset) as a new service. The default service type is [[Kubernetes_Service_Concepts#ClusterIP|ClusterIP]], other type ([[Kubernetes_Service_Concepts#NodePort|NodePort]], [[Kubernetes_Service_Concepts#LoadBalancer|LoadBalancer]], or [[Kubernetes_Service_Concepts#ExternalName|ExternalName]]) can be specified with --type. | ||
kubectl expose pod pg-0 --port=5432 --name=postgres --type=NodePort | kubectl [-n default] expose pod pg-0 --port=5432 --target-port=5432 --name=postgres --type=NodePort |
Revision as of 23:15, 13 August 2019
Internal
Overview
expose dynamically exposes a resource (pod, service, replicationcontroller, deployment, replicaset) as a new service. The default service type is ClusterIP, other type (NodePort, LoadBalancer, or ExternalName) can be specified with --type.
kubectl [-n default] expose pod pg-0 --port=5432 --target-port=5432 --name=postgres --type=NodePort