Kubernetes Secret Manifest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Kubernetes Cluster Configuration Concepts")
 
Line 1: Line 1:
=Internal=
=Internal=
* [[Kubernetes_Cluster_Configuration_Concepts#Secret_Manifest|Kubernetes Cluster Configuration Concepts]]
* [[Kubernetes_Cluster_Configuration_Concepts#Secret_Manifest|Kubernetes Cluster Configuration Concepts]]
=Example=
[[Kubernetes_Manifests#apiVersion|apiVersion]]: v1
[[Kubernetes_Manifests#kind|kind]]: Pod
[[Kubernetes_Manifest_Metadata#Overview|metadata]]:
  [[Kubernetes_Manifest_Metadata#name|name]]: loop
  [[Kubernetes_Manifest_Metadata#labels|labels]]:
    color: blue
  [[Kubernetes_Manifest_Metadata#annotations|annotations]]:
    ...
[[Kubernetes_Manifests#spec|spec]]: 
  [[#restartPolicy|restartPolicy]]: Always
  schedulerName: default-scheduler
  terminationGracePeriodSeconds: 120
  [[#serviceAccountName|serviceAccountName]]: 'testServiceAccount'
  [[#dnsPolicy|dnsPolicy]]: ClusterFirst
  [[#containers|containers]]:
  - [[#name|name]]: loop-container
    [[#image|image]]: docker.io/ovidiufeodorov/loop:latest
    [[#imagePullPolicy|imagePullPolicy]]: Always
    [[#resources|resources]]:
      [[#requests|requests]]:
        memory: '1024Mi'
        cpu: '500m'
      [[#limits|limits]]:
        memory: '4096Mi'
        cpu: '1000m'
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    [[#command|command]]: ...
    [[#ports|ports]]:
    - [[#containerPort|containerPort]]: 8080
      [[#protocol|protocol]]: TCP
      [[#port_name|name]]: 'http'
    - containerPort: 8787
      protocol: TCP
    - containerPort: ...
      [[#hostPort|hostPort]]: ....
    env:
    - name: SOMETHING
      value: 'something else'
    [[#volumeMounts|volumeMounts]]:
    - [[#volume_name|name]]: 'mount-0'
      [[#mountPath|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|subPath]]: 'orange'
    [[#readinessProbe|readinessProbe]]:
      # See [[Kubernetes_Container_Probes#Probe_Template|Probe Template]]
    [[#livenessProbe|livenessProbe]]:
      # See [[Kubernetes_Container_Probes#Probe_Template|Probe Template]]
    [[#command|command]]: ['sh', '-c', 'while true; do echo .; sleep 2; done;']
  [[#initContainers|initContainers]]:
  - [[#name|name]]: init-container1
    [[#image|image]]: busybox
    [[#command|command]]: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
  <span id='volumes_manifest'></span>[[#volumes|volumes]]:
  - name: mount-0
    hostPath:
      # '/yellow' must contain an 'orange' sub-directory
      path: '/yellow'
  - name: mount-1
    persistentVolumeClaim:
      claimName: pvc1

Revision as of 18:15, 29 October 2020

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