# DEPLOYMENT
apiVersion: apps/v1
kind: Deployment
metadata:
name: <u>***nginx-deployment***</u>
labels:
app: <u>***nginx***</u>
spec:
replicas: 2
selector:
matchLabels:
app: <u>***nginx***</u>
template:
metadata:
labels:
app: <u>***nginx***</u>
spec:
name: nginx
image: nginx:1.16
ports:
- containerPort: <u>***8080***</u>
...
# SERVICE
apiVersion: v1
kind: Service
metadata:
name: <u>***nginx-service***</u>
spec:
selector:
app: <u>***nginx***</u>
ports:
- protocol: TCP
port: 80
targetPort: <u>***8080***</u>
In this example:
:80targetPort from service and containerPort from deployment are mapped to each other