-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1624 from hunchback/k8s-storage-links
K8s storage links
- Loading branch information
Showing
14 changed files
with
231 additions
and
7 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: task-pv-claim | ||
spec: | ||
storageClassName: standard | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 3Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
kind: Pod | ||
apiVersion: v1 | ||
metadata: | ||
name: task-pv-pod | ||
spec: | ||
volumes: | ||
- name: task-pv-storage | ||
persistentVolumeClaim: | ||
claimName: task-pv-claim | ||
containers: | ||
- name: task-pv-container | ||
image: nginx | ||
ports: | ||
- containerPort: 80 | ||
name: "http-server" | ||
volumeMounts: | ||
- mountPath: "/usr/share/nginx/html" | ||
name: task-pv-storage | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: task-pv-volume | ||
labels: | ||
type: local | ||
spec: | ||
storageClassName: standard | ||
capacity: | ||
storage: 10Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: "/mnt/skydive-test-storage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
# | ||
# this is driver to running the scenario found here: | ||
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ | ||
|
||
SRC=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
|
||
: ${NAMESPACE:=default} | ||
echo "export NAMESPACE=$NAMESPACE" | ||
|
||
DATA=/mnt/skydive-test-storage | ||
|
||
setup() { | ||
sudo mkdir -p $DATA | ||
sudo chmod 777 $DATA | ||
echo 'Hello from kubernetes storage' > $DATA/index.html | ||
} | ||
|
||
cleanup() { | ||
sudo rm -rf $DATA | ||
} | ||
|
||
create() { | ||
for file in "$@"; do | ||
kubectl apply -n $NAMESPACE -f $file | ||
shift | ||
done | ||
} | ||
|
||
delete() { | ||
for file in "$@"; do | ||
kubectl delete --grace-period=0 --force -n $NAMESPACE -f $file | ||
shift | ||
done | ||
} | ||
|
||
stop() { | ||
delete $SRC/pv-pod.yaml | ||
delete $SRC/pv-claim.yaml | ||
delete $SRC/pv-volume.yaml | ||
kubectl delete namespace $NAMESPACE | ||
cleanup | ||
} | ||
|
||
start() { | ||
setup | ||
kubectl create namespace $NAMESPACE | ||
create $SRC/pv-volume.yaml | ||
create $SRC/pv-claim.yaml | ||
create $SRC/pv-pod.yaml | ||
} | ||
|
||
case "$1" in | ||
stop) | ||
stop | ||
;; | ||
start) | ||
start | ||
;; | ||
*) | ||
echo "$0 [stop|start|help]" | ||
exit 1 | ||
;; | ||
esac | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters