Dual container pod in Kubernetes

5 min read
Dual container pod in Kubernetes

Deploying a static and dynamic site inside k8s Writing a deployment for a two container pod with both static and dynamic content

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
labels:
    app: ofelbarweb
name: ofelbarweb
spec:
replicas: 1
selector:
    matchLabels:
    app: ofelbarweb
strategy:
    type: Recreate
template:
    metadata:
    creationTimestamp: null
    labels:
        app: ofelbarweb
    spec:
    containers:
    - image: pylab2.enskede.local:5000/ofelbarweb:py38-1.5.1
        imagePullPolicy: IfNotPresent
        name: ofelbarweb
        ports:
        - containerPort: 8000
        name: web
        protocol: TCP
    - image: pylab2.enskede.local:5000/ofelbar-static:1.0.3
        imagePullPolicy: IfNotPresent
        name: ofelbarweb-static
        ports:
        - containerPort: 80
        name: web-static
        protocol: TCP
    dnsPolicy: ClusterFirst
    restartPolicy: Always
    schedulerName: default-scheduler
    securityContext: {}
    terminationGracePeriodSeconds: 10
status:
availableReplicas: 1
conditions:
replicas: 1