Sample resources in bootstrap.yaml

The bootstrap.yaml file contains a terminal deployment, an NGINX deployment, and an NGINX service that you can apply together with one command.

The bootstrap.yaml file contains three resources: a terminal deployment, an NGINX deployment, and an NGINX service. To apply them with one command, save them in one file, and separate the resources with a line that contains only ---.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: terminal
spec:
  replicas: 1
  selector:
    matchLabels:
      app: terminal
  template:
    metadata:
      labels:
        app: terminal
    spec:
      containers:
        - name: terminal
          image: ubuntu:latest
          command: ["/bin/sh", "-c", "apt update && apt install -y curl && sleep infinity"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx # All pods created by this deployment have the label app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:latest
---
apiVersion: v1
kind: Service
metadata:
  name: test-nginx
spec:
  selector:
    app: nginx # Send packets to pods that have the label app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: ClusterIP