Difference between revisions of "Spec:"

From wikieduonline
Jump to navigation Jump to search
 
(22 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
  [[kind: Pod]]
 
  [[kind: Pod]]
 
  [[kind: Deployment]]
 
  [[kind: Deployment]]
 +
[[kind: ReplicaSet]]
 
  [[kind: CronJob]]
 
  [[kind: CronJob]]
 +
[[kind: PersistentVolumeClaim]]
 +
 +
[[kind: Deployment]]
  
  
 
  spec:
 
  spec:
   containers:
+
   [[containers:]]
 
   - name: MyNginxContainer
 
   - name: MyNginxContainer
 
     [[image]]: [[nginx]]
 
     [[image]]: [[nginx]]
Line 16: Line 20:
 
         [[tty:]] true
 
         [[tty:]] true
 
         [[stdin:]] true
 
         [[stdin:]] true
 +
 +
[[spec.tls|spec]]:
 +
  tls:
 +
    - hosts:
 +
        - ingress-demo.example.com
 +
      secretName: ingress-demo-tls
 +
 +
spec:
 +
  [[podSelector:]]
 +
    [[matchLabels:]]
 +
      app: elasticsearch-master
 +
 +
spec:
 +
  [[topologySpreadConstraints:]]
 +
 +
spec:
 +
  [[securityContext:]]
 +
 +
 +
    [[spec:]]
 +
      [[serviceAccountName]]: my-service-account
 +
      containers:
 +
      - name: my-app
 +
        image: public.ecr.aws/nginx/nginx:X.XX
 +
 +
{{Deployment example}}
 +
 +
== Official example container using secrets ==
 +
https://kubernetes.io/docs/concepts/configuration/secret/
 +
apiVersion: v1
 +
[[kind: Pod]]
 +
metadata:
 +
  name: secret-env-pod
 +
[[spec:]]
 +
  [[containers:]]
 +
  - name: mycontainer
 +
    image: redis
 +
    [[env:]]
 +
      - name: SECRET_USERNAME
 +
        [[valueFrom:]]
 +
          [[secretKeyRef:]]
 +
            name: mysecret
 +
            key: username
 +
            optional: false # same as default; "mysecret" must exist
 +
                            # and include a key named "username"
 +
      - name: SECRET_PASSWORD
 +
        valueFrom:
 +
          secretKeyRef:
 +
            name: mysecret
 +
            key: password
 +
            optional: false # same as default; "mysecret" must exist
 +
                            # and include a key named "password"
 +
  [[restartPolicy:]] Never
  
 
== Related ==
 
== Related ==
 
* <code>[[kind:]]</code>
 
* <code>[[kind:]]</code>
 +
* <code>[[cpu:]]</code>
 +
* <code>[[data:]]</code>
 +
[[spec.containers]]
 +
[[spec.resources]]
 +
[[spec.rules]]
 +
[[spec.match]]
 +
.[[spec.volumes]]
  
 
== See also ==
 
== See also ==
 +
* {{spec}}
 
* {{Kind}}
 
* {{Kind}}
 
* {{Kubernetes API}}
 
* {{Kubernetes API}}
  
 
[[Category:Kubernetes]]
 
[[Category:Kubernetes]]

Latest revision as of 13:27, 13 February 2024

kind: Pod
kind: Deployment
kind: ReplicaSet
kind: CronJob
kind: PersistentVolumeClaim
kind: Deployment


spec:
  containers:
  - name: MyNginxContainer
    image: nginx
spec:
     containers:
     - name: your-name
       image: your-name:latest
       tty: true
       stdin: true
spec:
  tls:
    - hosts:
        - ingress-demo.example.com
      secretName: ingress-demo-tls
spec:
  podSelector:
    matchLabels:
      app: elasticsearch-master
spec:
  topologySpreadConstraints:
spec:
  securityContext:


    spec:
      serviceAccountName: my-service-account
      containers:
      - name: my-app
        image: public.ecr.aws/nginx/nginx:X.XX
ApiVersion: apps/v1
kind: Deployment
metadata:
  name: spread-host-az
  labels:
    app: web-server
spec:
  replicas: 4
.../...

Official example container using secrets[edit]

https://kubernetes.io/docs/concepts/configuration/secret/

apiVersion: v1
kind: Pod
metadata:
  name: secret-env-pod
spec:
  containers:
  - name: mycontainer
    image: redis
    env:
      - name: SECRET_USERNAME
        valueFrom:
          secretKeyRef:
            name: mysecret
            key: username
            optional: false # same as default; "mysecret" must exist
                            # and include a key named "username"
      - name: SECRET_PASSWORD
        valueFrom:
          secretKeyRef:
            name: mysecret
            key: password
            optional: false # same as default; "mysecret" must exist
                            # and include a key named "password"
  restartPolicy: Never

Related[edit]

spec.containers
spec.resources
spec.rules
spec.match
.spec.volumes

See also[edit]

Advertising: