Files
www.cialloo.com/script/k8s/service.yaml

30 lines
705 B
YAML

# Kubernetes Service Configuration
# Service exposes pods to network traffic within the cluster
apiVersion: v1
kind: Service
metadata:
# Name of the service
name: ${CONTAINER_IMAGE_NAME}
# Namespace where service will be created
namespace: ${KUBERNETES_NAMESPACE}
labels:
app: ${CONTAINER_IMAGE_NAME}
spec:
# Type of service - ClusterIP is internal only
type: ClusterIP
# Service will route traffic to pods with these labels
selector:
app: ${CONTAINER_IMAGE_NAME}
# Port mapping
ports:
- name: http
# Port that service listens on
port: 80
# Port on the pod that receives traffic
targetPort: http
# Protocol to use
protocol: TCP