Sunday, July 24, 2022

Create Kubernetes ClusterIP Service Definition using YAML

A ClusterIP service is the default Kubernetes service. It gives you a service inside your cluster that other apps/pods inside your cluster can access. There is no external access. 

The YAML for a ClusterIP service looks like this:
# cat clusterIP.yaml
apiVersion: v1
kind: Service
metadata:  
  name: my-internal-service
spec:
  selector:    
    app: my-app
  type: ClusterIP
  ports:  
  - name: http
    port: 80
    targetPort: 8080
    protocol: TCP
    
You can create the Service by using kubectl apply -f clusterIP.yaml. After you create the Service, you can use kubectl get service to see the stable IP address

No comments:

Post a Comment

Create Kubernetes ClusterIP Service Definition using YAML

A ClusterIP service is the default Kubernetes service. It gives you a service inside your cluster that other apps/pods inside your cluster c...