Kubectl expose: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:


  kubectl [-n default] expose pod pg-0 --port=5432 --target-port=5432 --name=postgres --type=NodePort
  kubectl [-n default] expose pod pg-0 --port=5432 --target-port=5432 --name=postgres --type=NodePort
<font color=darkgray>TODO: I don't seem to see the service with kubectl get services, but attempting to connect to the database works.</font>

Revision as of 23:16, 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

TODO: I don't seem to see the service with kubectl get services, but attempting to connect to the database works.