minikube.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env bash
  2. # Copyright 2016 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Run the CockroachDB PetSet example on a minikube instance.
  16. #
  17. # For a fresh start, run the following first:
  18. # minikube delete
  19. # minikube start
  20. #
  21. # To upgrade minikube & kubectl on OSX, the following should suffice:
  22. # brew reinstall kubernetes-cli --devel
  23. # url -Lo minikube \
  24. # https://storage.googleapis.com/minikube/releases/v0.4.0/minikube-darwin-amd64 && \
  25. # chmod +x minikube && sudo mv minikube /usr/local/bin/
  26. set -exuo pipefail
  27. # Make persistent volumes and (correctly named) claims. We must create the
  28. # claims here manually even though that sounds counter-intuitive. For details
  29. # see https://github.com/kubernetes/contrib/pull/1295#issuecomment-230180894.
  30. # Note that we make an extra volume here so you can manually test scale-up.
  31. for i in $(seq 0 5); do
  32. cat <<EOF | kubectl create -f -
  33. kind: PersistentVolume
  34. apiVersion: v1
  35. metadata:
  36. name: pv${i}
  37. labels:
  38. type: local
  39. spec:
  40. capacity:
  41. storage: 1Gi
  42. accessModes:
  43. - ReadWriteOnce
  44. hostPath:
  45. path: "/tmp/${i}"
  46. EOF
  47. cat <<EOF | kubectl create -f -
  48. kind: PersistentVolumeClaim
  49. apiVersion: v1
  50. metadata:
  51. name: datadir-cockroachdb-${i}
  52. spec:
  53. accessModes:
  54. - ReadWriteOnce
  55. resources:
  56. requests:
  57. storage: 1Gi
  58. EOF
  59. done;
  60. kubectl create -f cockroachdb-petset.yaml