Kubernetes Cookbook
上QQ阅读APP看书,第一时间看更新

Creating a Service for different resources

You can attach a Service to a Pod, a Deployment, an endpoint outside the Kubernetes system, or even another Service. We will show you these, one by one, in this section. The creation of the Kubernetes Service looks similar to these command formats: kubectl expose $RESOURCE_TYPE $RESOURCE_NAME [OTHER TAGS] or kubectl expose -f $CONFIG_FILE. The resource types (Pod, Deployment, and Service) are supported by the subcommand expose. So is the configuration file, which follows the limitation type. Accordingly, for a later demonstration we will attach the newly created Service to the endpoint by the configuration file.