Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ff2ddbf2
Commit
ff2ddbf2
authored
Dec 21, 2016
by
Alex Robinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pod anti-affinity and a disruption budget to cockroachdb example
parent
953488e9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
README.md
examples/cockroachdb/README.md
+1
-1
cockroachdb-statefulset.yaml
examples/cockroachdb/cockroachdb-statefulset.yaml
+29
-0
minikube.sh
examples/cockroachdb/minikube.sh
+1
-1
No files found.
examples/cockroachdb/README.md
View file @
ff2ddbf2
...
@@ -116,7 +116,7 @@ Because all of the resources in this example have been tagged with the label `ap
...
@@ -116,7 +116,7 @@ Because all of the resources in this example have been tagged with the label `ap
we can clean up everything that we created in one quick command using a selector on that label:
we can clean up everything that we created in one quick command using a selector on that label:
```
shell
```
shell
kubectl delete statefulsets,p
ods,persistentvolumes,persistentvolumeclaims,services
-l
app
=
cockroachdb
kubectl delete statefulsets,p
ersistentvolumes,persistentvolumeclaims,services,poddisruptionbudget
-l
app
=
cockroachdb
```
```
...
...
examples/cockroachdb/cockroachdb-statefulset.yaml
View file @
ff2ddbf2
...
@@ -54,6 +54,18 @@ spec:
...
@@ -54,6 +54,18 @@ spec:
selector
:
selector
:
app
:
cockroachdb
app
:
cockroachdb
---
---
apiVersion
:
policy/v1beta1
kind
:
PodDisruptionBudget
metadata
:
name
:
cockroachdb-budget
labels
:
app
:
cockroachdb
spec
:
selector
:
matchLabels
:
app
:
cockroachdb
minAvailable
:
67%
---
apiVersion
:
apps/v1beta1
apiVersion
:
apps/v1beta1
kind
:
StatefulSet
kind
:
StatefulSet
metadata
:
metadata
:
...
@@ -66,6 +78,22 @@ spec:
...
@@ -66,6 +78,22 @@ spec:
labels
:
labels
:
app
:
cockroachdb
app
:
cockroachdb
annotations
:
annotations
:
scheduler.alpha.kubernetes.io/affinity
:
>
{
"podAntiAffinity": {
"preferredDuringSchedulingIgnoredDuringExecution": [{
"weight": 100,
"labelSelector": {
"matchExpressions": [{
"key": "app",
"operator": "In",
"values": ["cockroachdb"]
}]
},
"topologyKey": "kubernetes.io/hostname"
}]
}
}
# Init containers are run only once in the lifetime of a pod, before
# Init containers are run only once in the lifetime of a pod, before
# it's started up for the first time. It has to exit successfully
# it's started up for the first time. It has to exit successfully
# before the pod's main containers are allowed to start.
# before the pod's main containers are allowed to start.
...
@@ -80,6 +108,7 @@ spec:
...
@@ -80,6 +108,7 @@ spec:
{
{
"name":
"bootstrap",
"name":
"bootstrap",
"image":
"cockroachdb/cockroach-k8s-init:0.1",
"image":
"cockroachdb/cockroach-k8s-init:0.1",
"imagePullPolicy":
"IfNotPresent",
"args":
[
"args":
[
"-on-start=/on-start.sh",
"-on-start=/on-start.sh",
"-service=cockroachdb"
"-service=cockroachdb"
...
...
examples/cockroachdb/minikube.sh
View file @
ff2ddbf2
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
set
-exuo
pipefail
set
-exuo
pipefail
# Clean up anything from a prior run:
# Clean up anything from a prior run:
kubectl delete statefulsets,p
ods,persistentvolumes,persistentvolumeclaims,services
-l
app
=
cockroachdb
kubectl delete statefulsets,p
ersistentvolumes,persistentvolumeclaims,services,poddisruptionbudget
-l
app
=
cockroachdb
# Make persistent volumes and (correctly named) claims. We must create the
# Make persistent volumes and (correctly named) claims. We must create the
# claims here manually even though that sounds counter-intuitive. For details
# claims here manually even though that sounds counter-intuitive. For details
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment