K8s sandbox

From UVOO Tech Wiki
Revision as of 02:32, 10 October 2021 by Busk (talk | contribs) (Created page with "``` apiVersion: apps/v1 kind: Deployment metadata: name: testnginx-deployment namespace: test spec: selector: matchLabels: app: testnginx replicas: 2 templ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
apiVersion: apps/v1
kind: Deployment
metadata:
  name: testnginx-deployment
  namespace: test
spec:
  selector:
    matchLabels:
      app: testnginx
  replicas: 2
  template:
    metadata:
      labels:
        app: testnginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: testnginx-service
spec:
  type: NodePort
  selector:
    app: testnginx
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 80
      targetPort: 80
      # Optional field
      # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
      nodePort: 30007

Ref: - https://github.com/nginxinc/kubernetes-ingress/blob/master/examples/complete-example/cafe-ingress.yaml - https://kubernetes.io/docs/concepts/services-networking/service/