Difference between revisions of "Kubectl create clusterip"

From wikieduonline
Jump to navigation Jump to search
Line 2: Line 2:
 
<code>[[kubectl create]] [[clusterip]]</code>
 
<code>[[kubectl create]] [[clusterip]]</code>
 
  [[kubectl create service clusterip]]
 
  [[kubectl create service clusterip]]
 +
 +
 +
apiVersion: v1
 +
kind: Service
 +
metadata:
 +
  name: my-service
 +
spec:
 +
  selector:
 +
    app.kubernetes.io/name: MyApp
 +
  ports:
 +
    - protocol: TCP
 +
      port: 80
 +
      targetPort: 9376
  
 
* https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-service-clusterip-em-
 
* https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-service-clusterip-em-

Revision as of 13:23, 9 December 2022

kubectl create clusterip

kubectl create service clusterip


apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app.kubernetes.io/name: MyApp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
  • ClusterIP (default ServiceType): exposes the Service on a cluster internal IP then your service is only reachable from within the cluster.


See also

Advertising: