apiVersion: v1
kind: Pod
metadata:
  name: frontend
  namespace: staging
  labels:
    role: frontend
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - name: http
      containerPort: 80
      protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: frontend
  namespace: staging
  labels:
    role: frontend
spec:
  selector:
    role: frontend
  ports:
  - protocol: TCP
    port: 80
    targetPort: http
---
apiVersion: v1
kind: Pod
metadata:
  name: backend
  namespace: staging
  labels:
    role: backend
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - name: http
      containerPort: 80
      protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: backend
  namespace: staging
  labels:
    role: backend
spec:
  selector:
    role: backend
  ports:
  - protocol: TCP
    port: 80
    targetPort: http
---
apiVersion: v1
kind: Pod
metadata:
  name: db
  namespace: staging
  labels:
    role: db
spec:
  containers:
  - name: postgres
    image: postgres
    ports:
    - name: postgres
      containerPort: 5432
      protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: db
  namespace: staging
  labels:
    role: db
spec:
  selector:
    role: db
  ports:
  - protocol: TCP
    port: 5432
    targetPort: postgres
