Skip to content

Commit

Permalink
pod presets
Browse files Browse the repository at this point in the history
  • Loading branch information
wardviaene committed Aug 13, 2018
1 parent 8154dfd commit 6b00448
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pod-presets/README.md
Original file line number Diff line number Diff line change
@@ -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
```
35 changes: 35 additions & 0 deletions pod-presets/deployments.yaml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions pod-presets/pod-presets.yaml
Original file line number Diff line number Diff line change
@@ -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: {}

0 comments on commit 6b00448

Please sign in to comment.