mirror of
https://github.com/wardviaene/kubernetes-course.git
synced 2026-02-14 17:49:56 +00:00
pod presets
This commit is contained in:
36
pod-presets/README.md
Normal file
36
pod-presets/README.md
Normal 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
|
||||
```
|
||||
35
pod-presets/deployments.yaml
Normal file
35
pod-presets/deployments.yaml
Normal 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
|
||||
17
pod-presets/pod-presets.yaml
Normal file
17
pod-presets/pod-presets.yaml
Normal 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: {}
|
||||
Reference in New Issue
Block a user