diff --git a/content/en/docs/concepts/services-networking/service.md b/content/en/docs/concepts/services-networking/service.md index c14e4765c7..7bad537454 100644 --- a/content/en/docs/concepts/services-networking/service.md +++ b/content/en/docs/concepts/services-networking/service.md @@ -106,19 +106,7 @@ For example, suppose you have a set of Pods that each listen on TCP port 9376 and are labelled as `app.kubernetes.io/name=MyApp`. You can define a Service to publish that TCP listener: -```yaml -apiVersion: v1 -kind: Service -metadata: - name: my-service -spec: - selector: - app.kubernetes.io/name: MyApp - ports: - - protocol: TCP - port: 80 - targetPort: 9376 -``` +{{% code_sample file="service/simple-service.yaml" %}} Applying this manifest creates a new Service named "my-service" with the default ClusterIP [service type](#publishing-services-service-types). The Service diff --git a/content/en/examples/service/simple-service.yaml b/content/en/examples/service/simple-service.yaml new file mode 100644 index 0000000000..afcf1178cc --- /dev/null +++ b/content/en/examples/service/simple-service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: my-service +spec: + selector: + app.kubernetes.io/name: MyApp + ports: + - protocol: TCP + port: 80 + targetPort: 9376