Difference between revisions of "Kind: Service"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
== Oficial example == | == Oficial example == | ||
− | + | ||
+ | apiVersion: v1 | ||
kind: Service | kind: Service | ||
metadata: | metadata: | ||
name: my-service | name: my-service | ||
spec: | spec: | ||
− | + | selector: | |
− | app: MyApp | + | [[app.kubernetes.io/name]]: MyApp |
ports: | ports: | ||
- protocol: TCP | - protocol: TCP | ||
port: 80 | port: 80 | ||
− | + | targetPort: 9376 | |
== Examples == | == Examples == |
Revision as of 17:23, 15 February 2024
kind: Service
to create a Kubernetes service
Contents
Oficial example
apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376
Examples
apiVersion: v1 kind: Service metadata: annotations: {} name: your_service namespace: your_namespace spec: ports: - name: http port: 8080 protocol: TCP targetPort: 8080 selector: app: you_app sessionAffinity: None type: ClusterIP
apiVersion: v1 kind: Service metadata: name: example-service spec: selector: app: example ports: - port: 8765 targetPort: 9376 type: LoadBalancer
Related
See also
- Kubernetes services,
kubectl get services, kubectl describe service
,kubectl create service
[loadbalancer
|nodeport
|clusterip
|externalname ], kubectl expose
,headless service, service.beta.kubernetes.io
kind:
[Pod | Ingress | ClusterConfiguration
|Config | ConfigMap | ServiceAccount | Deployment | List | Secret | Status ], spec: metadata: data:
Advertising: