The provided YAML configuration defines a Kubernetes Deployment and a Service for a backend application named condor-backend. Let's break down what each part does:
apiVersion: v1: Specifies the API version for the Service resource.
kind: Service: Defines the type of resource as a Service.
metadata: Contains metadata about the Service.
name: condor-backend-service: The name of the Service.
spec: Specifies the desired state of the Service.
selector: Selects Pods with the label app: condor-backend.
type: ClusterIP: The type of Service, which exposes the Service on a cluster-internal IP.
ports: Ports to expose.
protocol: TCP: The protocol to use.
port: 8080: The port the Service exposes.
targetPort: 8080: The port on the Pods that the Service forwards traffic to.
Deployment and Service Interaction
When you deploy this configuration, Kubernetes will:
Create a Deployment named condor-backend with 1 replica (pod).
The Pod will run a container named condor-backend-server using the specified Docker image (which is currently empty).
The container will listen on port 8080 and have resource requests and limits set.
A startup probe will check if the container is ready by attempting to connect to port 8080.
The Pod will be scheduled on nodes with the label node-purpose: backend-serving.
A Service named condor-backend-service will be created to expose the Pods with the label app: condor-backend on port 8080.
Why 7 Pods?
The configuration specifies replicas: 1, which means only one Pod should be created. If you are seeing 7 Pods, it is likely due to a different configuration or a misconfiguration elsewhere in your Kubernetes cluster. Ensure that there are no other Deployments or configurations that might be creating additional Pods for the same application.