Guest User

deployment-yaml-file

a guest
May 11th, 2022
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.64 KB | None | 0 0
  1. kind: Deployment
  2. apiVersion: apps/v1
  3. metadata:
  4.   name: testapp
  5. spec:
  6.   replicas: 1
  7.   selector:
  8.     matchLabels:
  9.       app: testapp
  10.   template:
  11.     metadata:
  12.       labels:
  13.         app: testapp
  14.     spec:
  15.       containers:
  16.         - name: testapp
  17.           image: >-
  18.             <path to repo>
  19.           imagePullPolicy: Always
  20.           args:
  21.          - /bin/sh
  22.           - -c
  23.           - >
  24.            i=0;
  25.             while true;
  26.             do
  27.               echo "$i: $(date)" >> /var/log/1.log;
  28.               echo "$(date) INFO $i" >> /var/log/2.log;
  29.               i=$((i+1));
  30.               sleep 1;
  31.             done
  32.           volumeMounts:
  33.           - name: varlog
  34.             mountPath: /var/log
  35.         - name: count-log-1
  36.           image: <path to repo>
  37.           args: [/bin/sh, -c, 'tail -n+1 -F /var/log/1.log']
  38.           volumeMounts:
  39.           - name: varlog
  40.             mountPath: /var/log
  41.         - name: count-log-2
  42.           image: <path to repo>
  43.           args: [/bin/sh, -c, 'tail -n+1 -F /var/log/2.log']
  44.           volumeMounts:
  45.           - name: varlog
  46.             mountPath: /var/log
  47.           env:
  48.             - name: SECRET_USERNAME
  49.               <some secrets>
  50.           ports:
  51.             - containerPort: 80
  52.       volumes:
  53.         - name: varlog
  54.           emptyDir: {}          
  55.                
  56.  
  57. ---
  58. apiVersion: v1
  59. kind: Service
  60. metadata:
  61.   name: testapp
  62.   annotations:
  63.     service.beta.kubernetes.io/azure-load-balancer-internal: "true"
  64. spec:
  65.   type: LoadBalancer
  66.   selector:
  67.     app: testapp
  68.   ports:
  69.     - name: http
  70.       port: 80
  71.       targetPort: 80
  72.       protocol: TCP
  73.  
Advertisement
Add Comment
Please, Sign In to add comment