Kubernetes Secret Manifest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 5: Line 5:
=Internal=
=Internal=
* [[Kubernetes_Cluster_Configuration_Concepts#Secret_Manifest|Kubernetes Cluster Configuration Concepts]]
* [[Kubernetes_Cluster_Configuration_Concepts#Secret_Manifest|Kubernetes Cluster Configuration Concepts]]
* [[Kubernetes_Secrets_Operations#From_a_Manifest|Kubernetes Secrets Operations]]
=Example=
=Example=



Revision as of 18:19, 29 October 2020

External

Internal

Example

apiVersion: v1
kind: Pod
metadata:
  name: loop
  labels:
    color: blue
  annotations:
    ...
spec:  
  restartPolicy: Always
  schedulerName: default-scheduler
  terminationGracePeriodSeconds: 120
  serviceAccountName: 'testServiceAccount'
  dnsPolicy: ClusterFirst
  containers:
  - name: loop-container
    image: docker.io/ovidiufeodorov/loop:latest
    imagePullPolicy: Always
    resources:
      requests:
        memory: '1024Mi'
        cpu: '500m'
      limits:
        memory: '4096Mi'
        cpu: '1000m'
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    command: ...
    ports:
    - containerPort: 8080
      protocol: TCP
      name: 'http'
    - containerPort: 8787
      protocol: TCP
    - containerPort: ...
      hostPort: ....
    env:
    - name: SOMETHING
      value: 'something else'
    volumeMounts:
    - name: 'mount-0'
      mountPath: '/red'
      # 'orange' must exist in the root of the volume identified by 'mount-0'; the content of that
      # directory will be exposed in the container under the '/red' directory.
      subPath: 'orange' 
    readinessProbe:
      # See Probe Template
    livenessProbe:
      # See Probe Template
    command: ['sh', '-c', 'while true; do echo .; sleep 2; done;']
  initContainers:
  - name: init-container1
    image: busybox
    command: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
  volumes:
  - name: mount-0
    hostPath:
      # '/yellow' must contain an 'orange' sub-directory
      path: '/yellow'
  - name: mount-1
    persistentVolumeClaim:
     claimName: pvc1