From cac12e0ee189f433a00eb2c4789b894efdc34af1 Mon Sep 17 00:00:00 2001 From: Naresh Koduru Date: Tue, 28 Jan 2025 17:01:11 +0530 Subject: [PATCH] Enable copying service content --- .../docs/concepts/services-networking/service.md | 14 +------------- content/en/examples/service/simple-service.yaml | 11 +++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 content/en/examples/service/simple-service.yaml 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