github.com/qsunny/k8s@v0.0.0-20220101153623-e6dca256d5bf/examples-master/guestbook/all-in-one/frontend.yaml (about)

     1  apiVersion: v1
     2  kind: Service
     3  metadata:
     4    name: frontend
     5    labels:
     6      app: guestbook
     7      tier: frontend
     8  spec:
     9    # comment or delete the following line if you want to use a LoadBalancer
    10    type: NodePort 
    11    # if your cluster supports it, uncomment the following to automatically create
    12    # an external load-balanced IP for the frontend service.
    13    # type: LoadBalancer
    14    ports:
    15    - port: 80
    16    selector:
    17      app: guestbook
    18      tier: frontend
    19  ---
    20  apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
    21  kind: Deployment
    22  metadata:
    23    name: frontend
    24  spec:
    25    selector:
    26      matchLabels:
    27        app: guestbook
    28        tier: frontend
    29    replicas: 3
    30    template:
    31      metadata:
    32        labels:
    33          app: guestbook
    34          tier: frontend
    35      spec:
    36        containers:
    37        - name: php-redis
    38          image: gcr.io/google-samples/gb-frontend:v4
    39          resources:
    40            requests:
    41              cpu: 100m
    42              memory: 100Mi
    43          env:
    44          - name: GET_HOSTS_FROM
    45            value: dns
    46            # If your cluster config does not include a dns service, then to
    47            # instead access environment variables to find service host
    48            # info, comment out the 'value: dns' line above, and uncomment the
    49            # line below:
    50            # value: env
    51          ports:
    52          - containerPort: 80