apiVersion: v1 kind: Namespace metadata: name: nginx "labels": { "name": "nginx" } --- apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment namespace: nginx spec: selector: matchLabels: app: nginx replicas: 1 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx-service namespace: nginx spec: selector: app: nginx-deployment ports: - protocol: TCP port: 80 targetPort: 80