Difference between revisions of "Kind: Service"

From wikieduonline
Jump to navigation Jump to search
Line 23: Line 23:
 
  metadata:
 
  metadata:
 
   annotations: {}
 
   annotations: {}
   name: your_app
+
   name: your_service
 
   namespace: your_namespace
 
   namespace: your_namespace
 
  spec:
 
  spec:
Line 32: Line 32:
 
       targetPort: 8080
 
       targetPort: 8080
 
   selector:
 
   selector:
     app: watch
+
     app: you_app
 
   sessionAffinity: None
 
   sessionAffinity: None
 
   type: ClusterIP
 
   type: ClusterIP

Revision as of 12:04, 10 October 2023

kind: Service to create a Kubernetes service


Oficial example

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: 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

Related

See also

Advertising: