pod presets

This commit is contained in:
Edward Viaene
2018-08-13 17:59:57 +00:00
parent 8154dfdf2c
commit 6b00448749
3 changed files with 88 additions and 0 deletions

36
pod-presets/README.md Normal file
View File

@@ -0,0 +1,36 @@
# PodPresets
# Alpha status
As long as the PodPresets is in alpha status, the following changes need to be made in kops:
```
spec:
kubeAPIServer:
enableAdmissionPlugins:
- Initializers
- NamespaceLifecycle
- LimitRanger
- ServiceAccount
- PersistentVolumeLabel
- DefaultStorageClass
- DefaultTolerationSeconds
- MutatingAdmissionWebhook
- ValidatingAdmissionWebhook
- NodeRestriction
- ResourceQuota
- PodPreset
runtimeConfig:
settings.k8s.io/v1alpha1: "true"
```
# running the demo
First apply the PodPresets:
```
kubectl create -f pod-presets.yaml
```
Then run the deployments
```
kubectl create -f deployments.yaml
```

View File

@@ -0,0 +1,35 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: deployment-1
spec:
replicas: 3
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: k8s-demo
image: wardviaene/k8s-demo
ports:
- name: nodejs-port
containerPort: 3000
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: deployment-2
spec:
replicas: 3
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: k8s-demo
image: wardviaene/k8s-demo
ports:
- name: nodejs-port
containerPort: 3000

View File

@@ -0,0 +1,17 @@
apiVersion: settings.k8s.io/v1alpha1 # you might have to change this after PodPresets become stable
kind: PodPreset
metadata:
name: share-credential
spec:
selector:
matchLabels:
app: myapp
env:
- name: MY_SECRET
value: "123456"
volumeMounts:
- mountPath: /share
name: share-volume
volumes:
- name: share-volume
emptyDir: {}