Resource Configuration
Deployment
replicas
can be omitted
defaults to 1
all three labels must exactly match
containerPort
is for information purposes only and can be omitted
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: my-namespace
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
Service
spec.selector.app
must reference the label(-s) of the deployment (pod)targetPort
is the port of the podport
is the port of the service
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: my-namespace
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
Secret
PersistentVolumeClaim
IngressRoute
Middleware
Namespace
apiVersion: v1
kind: Namespace
metadata:
name: my-namespace
ConfigMap
see NGINX example
Mount a File not a Directory
see Using subPath
see https://gist.github.com/petitviolet/d36f33d145d0bbf4b54eb187b79d0244#gistcomment-3417108
volumeMounts:
- name: <config_map_name>
mountPath: /<path>/<filename>
subPath: <filename>
readOnly: true