├── .gitignore
├── LICENSE
├── OWNERS
├── README.md
├── cassandra
├── Makefile
├── OWNERS
├── README.md
├── cassandra-service.yaml
├── cassandra-statefulset.yaml
├── go
│ └── main.go
├── image
│ ├── Dockerfile
│ └── files
│ │ ├── build.sh
│ │ ├── cassandra-seed.h
│ │ ├── cassandra.yaml
│ │ ├── jvm.options
│ │ ├── kubernetes-cassandra.jar
│ │ ├── logback.xml
│ │ ├── ready-probe.sh
│ │ └── run.sh
└── java
│ ├── .gitignore
│ ├── README.md
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── io
│ │ └── k8s
│ │ └── cassandra
│ │ ├── GoInterface.java
│ │ └── KubernetesSeedProvider.java
│ └── test
│ ├── java
│ └── io
│ │ └── k8s
│ │ └── cassandra
│ │ └── KubernetesSeedProviderTest.java
│ └── resources
│ ├── cassandra.yaml
│ └── logback-test.xml
├── code-of-conduct.md
├── guestbook-go
├── .gitignore
├── Dockerfile
├── Makefile
├── README.md
├── guestbook-controller.json
├── guestbook-page.png
├── guestbook-service.json
├── main.go
├── public
│ ├── index.html
│ ├── script.js
│ └── style.css
├── redis-master-controller.json
├── redis-master-service.json
├── redis-slave-controller.json
└── redis-slave-service.json
├── guestbook
├── MAINTENANCE.md
├── README.md
├── all-in-one
│ ├── frontend.yaml
│ ├── guestbook-all-in-one.yaml
│ └── redis-slave.yaml
├── frontend-deployment.yaml
├── frontend-service.yaml
├── legacy
│ ├── frontend-controller.yaml
│ ├── redis-master-controller.yaml
│ └── redis-slave-controller.yaml
├── php-redis
│ ├── Dockerfile
│ ├── Makefile
│ ├── controllers.js
│ ├── guestbook.php
│ └── index.html
├── redis-master-deployment.yaml
├── redis-master-service.yaml
├── redis-slave-deployment.yaml
├── redis-slave-service.yaml
└── redis-slave
│ ├── Dockerfile
│ ├── Makefile
│ └── run.sh
├── guidelines.md
├── mysql-wordpress-pd
├── OWNERS
├── README.md
├── WordPress.png
├── gce-volumes.yaml
├── local-volumes.yaml
├── mysql-deployment.yaml
└── wordpress-deployment.yaml
└── staging
├── cloud-controller-manager
└── persistent-volume-label-initializer-config.yaml
├── cluster-dns
├── README.md
├── dns-backend-rc.yaml
├── dns-backend-service.yaml
├── dns-frontend-pod.yaml
├── images
│ ├── backend
│ │ ├── Dockerfile
│ │ ├── Makefile
│ │ └── server.py
│ └── frontend
│ │ ├── Dockerfile
│ │ ├── Makefile
│ │ └── client.py
├── namespace-dev.yaml
└── namespace-prod.yaml
├── cockroachdb
├── OWNERS
├── README.md
├── cockroachdb-statefulset.yaml
├── demo.sh
└── minikube.sh
├── cpu-manager
├── OWNERS
├── README.md
├── be.yaml
├── exclusive-1.yaml
├── exclusive-2.yaml
├── exclusive-3.yaml
├── exclusive-4.yaml
├── pod-ips
└── shared.yaml
├── doc.go
├── elasticsearch
├── README.md
├── es-rc.yaml
├── es-svc.yaml
├── production_cluster
│ ├── README.md
│ ├── es-client-rc.yaml
│ ├── es-data-rc.yaml
│ ├── es-discovery-svc.yaml
│ ├── es-master-rc.yaml
│ ├── es-svc.yaml
│ └── service-account.yaml
├── rbac.yaml
└── service-account.yaml
├── examples_test.go
├── explorer
├── Dockerfile
├── Makefile
├── README.md
├── explorer.go
└── pod.yaml
├── https-nginx
├── Dockerfile
├── Makefile
├── README.md
├── auto-reload-nginx.sh
├── default.conf
├── index2.html
├── make_secret.go
└── nginx-app.yaml
├── javaee
├── README.md
├── mysql-pod.yaml
├── mysql-service.yaml
└── wildfly-rc.yaml
├── javaweb-tomcat-sidecar
├── README.md
├── javaweb-2.yaml
├── javaweb.yaml
└── workflow.png
├── job
├── expansions
│ └── README.md
├── work-queue-1
│ └── README.md
└── work-queue-2
│ └── README.md
├── meteor
├── README.md
├── dockerbase
│ ├── Dockerfile
│ └── README.md
├── meteor-controller.json
├── meteor-service.json
├── mongo-pod.json
└── mongo-service.json
├── mysql-cinder-pd
├── README.md
├── mysql-service.yaml
└── mysql.yaml
├── newrelic-infrastructure
├── .gitignore
├── README.md
├── config-to-secret.sh
├── newrelic-config-template.yaml
├── newrelic-infra-daemonset.yaml
└── nrconfig.env
├── newrelic
├── README.md
├── config-to-secret.sh
├── newrelic-config-template.yaml
├── newrelic-config.yaml
├── newrelic-daemonset.yaml
└── nrconfig.env
├── nodesjs-mongodb
├── README.md
├── mongo-controller.yaml
├── mongo-service.yaml
├── web-controller-demo.yaml
├── web-controller.yaml
└── web-service.yaml
├── oms
└── README.md
├── openshift-origin
├── .gitignore
├── README.md
├── cleanup.sh
├── create.sh
├── etcd-controller.yaml
├── etcd-discovery-controller.yaml
├── etcd-discovery-service.yaml
├── etcd-service.yaml
├── openshift-controller.yaml
├── openshift-origin-namespace.yaml
├── openshift-service.yaml
└── secret.json
├── persistent-volume-provisioning
├── README.md
├── aws-ebs.yaml
├── cinder
│ ├── cinder-storage-class.yaml
│ └── example-pod.yaml
├── claim1.json
├── gce-pd.yaml
├── glusterfs
│ ├── glusterfs-secret.yaml
│ └── glusterfs-storageclass.yaml
├── quobyte
│ ├── example-pod.yaml
│ ├── quobyte-admin-secret.yaml
│ └── quobyte-storage-class.yaml
└── rbd
│ ├── ceph-secret-admin.yaml
│ ├── ceph-secret-user.yaml
│ ├── pod.yaml
│ └── rbd-storage-class.yaml
├── phabricator
├── README.md
├── phabricator-controller.json
├── phabricator-service.json
├── php-phabricator
│ ├── 000-default.conf
│ ├── Dockerfile
│ └── run.sh
├── setup.sh
└── teardown.sh
├── pod
├── podsecuritypolicy
├── OWNERS
└── rbac
│ ├── README.md
│ ├── bindings.yaml
│ ├── pod.yaml
│ ├── pod_priv.yaml
│ ├── policies.yaml
│ └── roles.yaml
├── runtime-constraints
└── README.md
├── scheduler-policy-config-with-extender.json
├── scheduler-policy-config.json
├── selenium
├── README.md
├── selenium-hub-deployment.yaml
├── selenium-hub-svc.yaml
├── selenium-node-chrome-deployment.yaml
├── selenium-node-firefox-deployment.yaml
└── selenium-test.py
├── sharing-clusters
├── README.md
└── make_secret.go
├── simple-nginx.md
├── spark
├── README.md
├── namespace-spark-cluster.yaml
├── spark-gluster
│ ├── README.md
│ ├── glusterfs-endpoints.yaml
│ ├── spark-master-controller.yaml
│ ├── spark-master-service.yaml
│ └── spark-worker-controller.yaml
├── spark-master-controller.yaml
├── spark-master-service.yaml
├── spark-ui-proxy-controller.yaml
├── spark-ui-proxy-service.yaml
├── spark-worker-controller.yaml
├── zeppelin-controller.yaml
└── zeppelin-service.yaml
├── storage
├── hazelcast
│ ├── README.md
│ ├── hazelcast-deployment.yaml
│ └── hazelcast-service.yaml
├── minio
│ ├── README.md
│ ├── minio-distributed-headless-service.yaml
│ ├── minio-distributed-service.yaml
│ ├── minio-distributed-statefulset.yaml
│ ├── minio-standalone-deployment.yaml
│ ├── minio-standalone-pvc.yaml
│ └── minio-standalone-service.yaml
├── mysql-galera
│ ├── README.md
│ ├── image
│ │ ├── Dockerfile
│ │ ├── cluster.cnf
│ │ ├── docker-entrypoint.sh
│ │ └── my.cnf
│ ├── pxc-cluster-service.yaml
│ ├── pxc-node1.yaml
│ ├── pxc-node2.yaml
│ └── pxc-node3.yaml
├── redis
│ ├── README.md
│ ├── image
│ │ ├── Dockerfile
│ │ ├── redis-master.conf
│ │ ├── redis-slave.conf
│ │ └── run.sh
│ ├── redis-controller.yaml
│ ├── redis-master.yaml
│ ├── redis-sentinel-controller.yaml
│ └── redis-sentinel-service.yaml
├── rethinkdb
│ ├── README.md
│ ├── admin-pod.yaml
│ ├── admin-service.yaml
│ ├── driver-service.yaml
│ ├── gen-pod.sh
│ ├── image
│ │ ├── Dockerfile
│ │ └── run.sh
│ └── rc.yaml
└── vitess
│ ├── README.md
│ ├── configure.sh
│ ├── create_test_table.sql
│ ├── env.sh
│ ├── etcd-controller-template.yaml
│ ├── etcd-down.sh
│ ├── etcd-service-template.yaml
│ ├── etcd-up.sh
│ ├── guestbook-controller.yaml
│ ├── guestbook-down.sh
│ ├── guestbook-service.yaml
│ ├── guestbook-up.sh
│ ├── vitess-down.sh
│ ├── vitess-up.sh
│ ├── vtctld-controller-template.yaml
│ ├── vtctld-down.sh
│ ├── vtctld-service.yaml
│ ├── vtctld-up.sh
│ ├── vtgate-controller-template.yaml
│ ├── vtgate-down.sh
│ ├── vtgate-service.yaml
│ ├── vtgate-up.sh
│ ├── vttablet-down.sh
│ ├── vttablet-pod-template.yaml
│ └── vttablet-up.sh
├── storm
├── README.md
├── storm-nimbus-service.json
├── storm-nimbus.json
├── storm-worker-controller.yaml
├── zookeeper-service.json
└── zookeeper.json
├── sysdig-cloud
├── README.md
├── sysdig-daemonset.yaml
└── sysdig-rc.yaml
└── volumes
├── aws_ebs
├── README.md
└── aws-ebs-web.yaml
├── azure_disk
├── README.md
├── azure.yaml
├── claim
│ ├── README.md
│ ├── blob-based-disk
│ │ ├── account-specified-hdd
│ │ │ ├── pod-uses-account-hdd.yaml
│ │ │ ├── pvc-on-account-hdd.yaml
│ │ │ └── storageclass-account-hdd.yaml
│ │ ├── dedicated-hdd
│ │ │ ├── pod-uses-dedicated-hdd.yaml
│ │ │ ├── pvc-on-dedicated-hdd.yaml
│ │ │ └── storageclass-dedicated-hdd.yaml
│ │ ├── shared-hdd
│ │ │ ├── pod-uses-shared-hdd.yaml
│ │ │ ├── pvc-on-shared-hdd.yaml
│ │ │ └── storageclass-shared-hdd.yaml
│ │ └── shared-ssd
│ │ │ ├── pod-uses-shared-ssd.yaml
│ │ │ ├── pvc-on-shared-ssd.yaml
│ │ │ └── storageclass-shared-ssd.yaml
│ └── managed-disk
│ │ ├── managed-hdd
│ │ ├── pod-uses-managed-hdd.yaml
│ │ ├── pvc-on-managed-hdd.yaml
│ │ └── storageclass-managed-hdd.yaml
│ │ └── managed-ssd
│ │ ├── pod-uses-managed-ssd.yaml
│ │ ├── pvc-on-managed-ssd.yaml
│ │ └── storageclass-managed-ssd.yaml
└── static-provisioning
│ └── managed-disk
│ └── pod-uses-existing-managed-disk.yaml
├── azure_file
├── README.md
├── azure-2.yaml
├── azure-pv.yaml
├── azure-pvc.yaml
├── azure.yaml
└── secret
│ └── azure-secret.yaml
├── cephfs
├── README.md
├── cephfs-with-secret.yaml
├── cephfs.yaml
└── secret
│ └── ceph-secret.yaml
├── cinder
├── README.md
└── cinder-web.yaml
├── fibre_channel
├── README.md
└── fc.yaml
├── flexvolume
├── README.md
├── deploy
│ ├── Dockerfile
│ ├── README.md
│ ├── deploy.sh
│ └── ds.yaml
├── dummy
├── dummy-attachable
├── lvm
├── nfs
├── nginx-dummy-attachable.yaml
├── nginx-dummy.yaml
├── nginx-lvm.yaml
├── nginx-nfs.yaml
└── nginx.yaml
├── flocker
├── README.md
├── flocker-pod-with-rc.yml
└── flocker-pod.yml
├── glusterfs
├── README.md
├── glusterfs-endpoints.json
├── glusterfs-pod.json
└── glusterfs-service.json
├── iscsi
├── README.md
├── chap-secret.yaml
├── iscsi-chap.yaml
└── iscsi.yaml
├── nfs
├── README.md
├── nfs-busybox-rc.yaml
├── nfs-data
│ ├── Dockerfile
│ ├── README.md
│ ├── index.html
│ └── run_nfs.sh
├── nfs-pv.png
├── nfs-pv.yaml
├── nfs-pvc.yaml
├── nfs-server-rc.yaml
├── nfs-server-service.yaml
├── nfs-web-rc.yaml
├── nfs-web-service.yaml
└── provisioner
│ └── nfs-server-gce-pv.yaml
├── portworx
├── README.md
├── portworx-volume-pod.yaml
├── portworx-volume-pv.yaml
├── portworx-volume-pvc.yaml
├── portworx-volume-pvcpod.yaml
├── portworx-volume-pvcsc.yaml
├── portworx-volume-pvcscpod.yaml
└── portworx-volume-sc-high.yaml
├── quobyte
├── Readme.md
└── quobyte-pod.yaml
├── rbd
├── README.md
├── rbd-with-secret.yaml
├── rbd.yaml
└── secret
│ └── ceph-secret.yaml
├── scaleio
├── README.md
├── pod-sc-pvc.yaml
├── pod.yaml
├── sc-pvc.yaml
├── sc.yaml
└── secret.yaml
├── storageos
├── README.md
├── storageos-pod.yaml
├── storageos-pv.yaml
├── storageos-pvc.yaml
├── storageos-pvcpod.yaml
├── storageos-sc-pvc.yaml
├── storageos-sc-pvcpod.yaml
├── storageos-sc.yaml
└── storageos-secret.yaml
└── vsphere
├── README.md
├── deployment.yaml
├── simple-statefulset.yaml
├── simple-storageclass.yaml
├── vsphere-volume-pod.yaml
├── vsphere-volume-pv.yaml
├── vsphere-volume-pvc.yaml
├── vsphere-volume-pvcpod.yaml
├── vsphere-volume-pvcsc.yaml
├── vsphere-volume-pvcscpod.yaml
├── vsphere-volume-pvcscvsanpod.yaml
├── vsphere-volume-sc-fast.yaml
├── vsphere-volume-sc-vsancapabilities-with-datastore.yaml
├── vsphere-volume-sc-vsancapabilities.yaml
├── vsphere-volume-sc-with-datastore.yaml
├── vsphere-volume-spbm-policy-with-datastore.yaml
└── vsphere-volume-spbm-policy.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX leaves these everywhere on SMB shares
2 | ._*
3 |
4 | # OSX trash
5 | .DS_Store
6 |
7 | # Eclipse files
8 | .classpath
9 | .project
10 | .settings/**
11 |
12 | # Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
13 | .idea/
14 | *.iml
15 |
16 | # Vscode files
17 | .vscode
18 |
19 | # Emacs save files
20 | *~
21 | \#*\#
22 | .\#*
23 |
24 | # Vim-related files
25 | [._]*.s[a-w][a-z]
26 | [._]s[a-w][a-z]
27 | *.un~
28 | Session.vim
29 | .netrwhist
30 |
31 | # cscope-related files
32 | cscope.*
33 |
34 | # JUnit test output from ginkgo e2e tests
35 | /junit*.xml
36 |
37 | # Mercurial files
38 | **/.hg
39 | **/.hg*
40 |
41 |
42 | .tags*
43 |
44 | /bazel-*
45 | *.pyc
46 |
--------------------------------------------------------------------------------
/OWNERS:
--------------------------------------------------------------------------------
1 | reviewers:
2 | - idvoretskyi
3 | - ahmetb
4 | - sebgoa
5 | approvers:
6 | - idvoretskyi
7 | - ahmetb
8 | - sebgoa
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Kubernetes Examples
2 |
3 | This directory contains a number of examples of how to run real applications
4 | with Kubernetes.
5 |
6 | Refer to the [Kubernetes documentation] for how to execute the tutorials.
7 |
8 | ### Maintained Examples
9 |
10 | Maintained Examples are expected to be updated with every Kubernetes release, to
11 | use the latest and greatest features, current guidelines and best practices,
12 | and to refresh command syntax, output, changed prerequisites, as needed.
13 |
14 | |Name | Description | Notable Features Used | Complexity Level|
15 | ------------- | ------------- | ------------ | ------------ |
16 | |[Guestbook](guestbook/) | PHP app with Redis | Deployment, Service | Beginner |
17 | |[WordPress](mysql-wordpress-pd/) | WordPress with MySQL | Deployment, Persistent Volume with Claim | Beginner|
18 | |[Cassandra](cassandra/) | Cloud Native Cassandra | Daemon Set, Stateful Set, Replication Controller | Intermediate
19 |
20 | > Note: Please add examples that are maintained to the list above.
21 |
22 | See [Example Guidelines](guidelines.md) for a description of what goes
23 | in this directory, and what examples should contain.
24 |
25 | [Kubernetes documentation]: https://kubernetes.io/docs/tutorials/
26 |
--------------------------------------------------------------------------------
/cassandra/OWNERS:
--------------------------------------------------------------------------------
1 | reviewers:
2 | - aledbf
3 | approvers:
4 | - aledbf
5 |
--------------------------------------------------------------------------------
/cassandra/README.md:
--------------------------------------------------------------------------------
1 | # Example: Cassandra with StatefulSets on Kubernetes
2 |
3 |
4 | This directory contains the source code and Kubernetes manifests for Cassandra
5 | deployment with StatefulSets tutorial.
6 |
7 | Follow this tutorial at https://kubernetes.io/docs/tutorials/stateful-application/cassandra/.
8 |
--------------------------------------------------------------------------------
/cassandra/cassandra-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app: cassandra
6 | name: cassandra
7 | spec:
8 | clusterIP: None
9 | ports:
10 | - port: 9042
11 | selector:
12 | app: cassandra
13 |
--------------------------------------------------------------------------------
/cassandra/image/files/kubernetes-cassandra.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nigelpoulton/k8s-sample-apps/90145b4f11aa6a40a7e376894430438b868dde2d/cassandra/image/files/kubernetes-cassandra.jar
--------------------------------------------------------------------------------
/cassandra/image/files/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %-5level %date{HH:mm:ss,SSS} %msg%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/cassandra/image/files/ready-probe.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2016 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | if [[ $(nodetool status | grep $POD_IP) == *"UN"* ]]; then
18 | if [[ $DEBUG ]]; then
19 | echo "UN";
20 | fi
21 | exit 0;
22 | else
23 | if [[ $DEBUG ]]; then
24 | echo "Not Up";
25 | fi
26 | exit 1;
27 | fi
28 |
--------------------------------------------------------------------------------
/cassandra/java/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 |
--------------------------------------------------------------------------------
/cassandra/java/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 | %-5level %date{HH:mm:ss,SSS} %msg%n
22 |
23 |
24 | DEBUG
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/code-of-conduct.md:
--------------------------------------------------------------------------------
1 | # Kubernetes Community Code of Conduct
2 |
3 | Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)
4 |
--------------------------------------------------------------------------------
/guestbook-go/.gitignore:
--------------------------------------------------------------------------------
1 | guestbook_bin
2 |
--------------------------------------------------------------------------------
/guestbook-go/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM golang:1.10.0
16 | RUN go get github.com/codegangsta/negroni \
17 | github.com/gorilla/mux \
18 | github.com/xyproto/simpleredis
19 | WORKDIR /app
20 | ADD ./main.go .
21 | RUN CGO_ENABLED=0 GOOS=linux go build -o main .
22 |
23 | FROM scratch
24 | WORKDIR /app
25 | COPY --from=0 /app/main .
26 | COPY ./public/index.html public/index.html
27 | COPY ./public/script.js public/script.js
28 | COPY ./public/style.css public/style.css
29 | CMD ["/app/main"]
30 | EXPOSE 3000
31 |
--------------------------------------------------------------------------------
/guestbook-go/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Build the guestbook-go example
16 |
17 | # Usage:
18 | # [VERSION=v3] [REGISTRY="staging-k8s.gcr.io"] make build
19 | VERSION?=v3
20 | REGISTRY?=staging-k8s.gcr.io
21 |
22 | release: clean build push clean
23 |
24 | # builds a docker image that builds the app and packages it into a minimal docker image
25 | build:
26 | docker build -t ${REGISTRY}/guestbook:${VERSION} .
27 |
28 | # push the image to an registry
29 | push:
30 | gcloud docker -- push ${REGISTRY}/guestbook:${VERSION}
31 |
32 | # remove previous images and containers
33 | clean:
34 | docker rm -f ${REGISTRY}/guestbook:${VERSION} 2> /dev/null || true
35 |
36 | .PHONY: release clean build push
37 |
--------------------------------------------------------------------------------
/guestbook-go/guestbook-controller.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind":"ReplicationController",
3 | "apiVersion":"v1",
4 | "metadata":{
5 | "name":"guestbook",
6 | "labels":{
7 | "app":"guestbook"
8 | }
9 | },
10 | "spec":{
11 | "replicas":3,
12 | "selector":{
13 | "app":"guestbook"
14 | },
15 | "template":{
16 | "metadata":{
17 | "labels":{
18 | "app":"guestbook"
19 | }
20 | },
21 | "spec":{
22 | "containers":[
23 | {
24 | "name":"guestbook",
25 | "image":"k8s.gcr.io/guestbook:v3",
26 | "ports":[
27 | {
28 | "name":"http-server",
29 | "containerPort":3000
30 | }
31 | ]
32 | }
33 | ]
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/guestbook-go/guestbook-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nigelpoulton/k8s-sample-apps/90145b4f11aa6a40a7e376894430438b868dde2d/guestbook-go/guestbook-page.png
--------------------------------------------------------------------------------
/guestbook-go/guestbook-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind":"Service",
3 | "apiVersion":"v1",
4 | "metadata":{
5 | "name":"guestbook",
6 | "labels":{
7 | "app":"guestbook"
8 | }
9 | },
10 | "spec":{
11 | "ports": [
12 | {
13 | "port":3000,
14 | "targetPort":"http-server"
15 | }
16 | ],
17 | "selector":{
18 | "app":"guestbook"
19 | },
20 | "type": "LoadBalancer"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/guestbook-go/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Guestbook
9 |
10 |
11 |
14 |
15 |
16 |
Waiting for database connection...
17 |
18 |
19 |
25 |
26 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/guestbook-go/public/style.css:
--------------------------------------------------------------------------------
1 | body, input {
2 | color: #123;
3 | font-family: "Gill Sans", sans-serif;
4 | }
5 |
6 | div {
7 | overflow: hidden;
8 | padding: 1em 0;
9 | position: relative;
10 | text-align: center;
11 | }
12 |
13 | h1, h2, p, input, a {
14 | font-weight: 300;
15 | margin: 0;
16 | }
17 |
18 | h1 {
19 | color: #BDB76B;
20 | font-size: 3.5em;
21 | }
22 |
23 | h2 {
24 | color: #999;
25 | }
26 |
27 | form {
28 | margin: 0 auto;
29 | max-width: 50em;
30 | text-align: center;
31 | }
32 |
33 | input {
34 | border: 0;
35 | border-radius: 1000px;
36 | box-shadow: inset 0 0 0 2px #BDB76B;
37 | display: inline;
38 | font-size: 1.5em;
39 | margin-bottom: 1em;
40 | outline: none;
41 | padding: .5em 5%;
42 | width: 55%;
43 | }
44 |
45 | form a {
46 | background: #BDB76B;
47 | border: 0;
48 | border-radius: 1000px;
49 | color: #FFF;
50 | font-size: 1.25em;
51 | font-weight: 400;
52 | padding: .75em 2em;
53 | text-decoration: none;
54 | text-transform: uppercase;
55 | white-space: normal;
56 | }
57 |
58 | p {
59 | font-size: 1.5em;
60 | line-height: 1.5;
61 | }
62 |
--------------------------------------------------------------------------------
/guestbook-go/redis-master-controller.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind":"ReplicationController",
3 | "apiVersion":"v1",
4 | "metadata":{
5 | "name":"redis-master",
6 | "labels":{
7 | "app":"redis",
8 | "role":"master"
9 | }
10 | },
11 | "spec":{
12 | "replicas":1,
13 | "selector":{
14 | "app":"redis",
15 | "role":"master"
16 | },
17 | "template":{
18 | "metadata":{
19 | "labels":{
20 | "app":"redis",
21 | "role":"master"
22 | }
23 | },
24 | "spec":{
25 | "containers":[
26 | {
27 | "name":"redis-master",
28 | "image":"redis:2.8.23",
29 | "ports":[
30 | {
31 | "name":"redis-server",
32 | "containerPort":6379
33 | }
34 | ]
35 | }
36 | ]
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/guestbook-go/redis-master-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind":"Service",
3 | "apiVersion":"v1",
4 | "metadata":{
5 | "name":"redis-master",
6 | "labels":{
7 | "app":"redis",
8 | "role":"master"
9 | }
10 | },
11 | "spec":{
12 | "ports": [
13 | {
14 | "port":6379,
15 | "targetPort":"redis-server"
16 | }
17 | ],
18 | "selector":{
19 | "app":"redis",
20 | "role":"master"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/guestbook-go/redis-slave-controller.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind":"ReplicationController",
3 | "apiVersion":"v1",
4 | "metadata":{
5 | "name":"redis-slave",
6 | "labels":{
7 | "app":"redis",
8 | "role":"slave"
9 | }
10 | },
11 | "spec":{
12 | "replicas":2,
13 | "selector":{
14 | "app":"redis",
15 | "role":"slave"
16 | },
17 | "template":{
18 | "metadata":{
19 | "labels":{
20 | "app":"redis",
21 | "role":"slave"
22 | }
23 | },
24 | "spec":{
25 | "containers":[
26 | {
27 | "name":"redis-slave",
28 | "image":"kubernetes/redis-slave:v2",
29 | "ports":[
30 | {
31 | "name":"redis-server",
32 | "containerPort":6379
33 | }
34 | ]
35 | }
36 | ]
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/guestbook-go/redis-slave-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind":"Service",
3 | "apiVersion":"v1",
4 | "metadata":{
5 | "name":"redis-slave",
6 | "labels":{
7 | "app":"redis",
8 | "role":"slave"
9 | }
10 | },
11 | "spec":{
12 | "ports": [
13 | {
14 | "port":6379,
15 | "targetPort":"redis-server"
16 | }
17 | ],
18 | "selector":{
19 | "app":"redis",
20 | "role":"slave"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/guestbook/MAINTENANCE.md:
--------------------------------------------------------------------------------
1 | ## Building the Docker images
2 |
3 | ```console
4 | $ docker build -t gcr.io/google-samples/gb-frontend:v5 php-redis
5 |
6 | $ docker build -t gcr.io/google-samples/gb-redisslave:v2 redis-slave
7 | ```
8 |
9 | Building Multi-architecture docker images
10 |
11 | ```console
12 | $ make -C php-redis
13 |
14 | $ make -C redis-slave
15 | ```
16 |
17 | Push:
18 |
19 | ```console
20 | $ make -C php-redis all-push
21 |
22 | $ make -C redis-slave all-push
23 | ```
24 |
--------------------------------------------------------------------------------
/guestbook/README.md:
--------------------------------------------------------------------------------
1 | # Example: Guestbook application on Kubernetes
2 |
3 | This directory contains the source code and Kubernetes manifests for PHP
4 | Guestbook application.
5 |
6 | Follow the tutorial at https://kubernetes.io/docs/tutorials/stateless-application/guestbook/.
7 |
--------------------------------------------------------------------------------
/guestbook/all-in-one/frontend.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: frontend
5 | labels:
6 | app: guestbook
7 | tier: frontend
8 | spec:
9 | # if your cluster supports it, uncomment the following to automatically create
10 | # an external load-balanced IP for the frontend service.
11 | # type: LoadBalancer
12 | ports:
13 | - port: 80
14 | selector:
15 | app: guestbook
16 | tier: frontend
17 | ---
18 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
19 | kind: Deployment
20 | metadata:
21 | name: frontend
22 | spec:
23 | selector:
24 | matchLabels:
25 | app: guestbook
26 | tier: frontend
27 | replicas: 3
28 | template:
29 | metadata:
30 | labels:
31 | app: guestbook
32 | tier: frontend
33 | spec:
34 | containers:
35 | - name: php-redis
36 | image: gcr.io/google-samples/gb-frontend:v4
37 | resources:
38 | requests:
39 | cpu: 100m
40 | memory: 100Mi
41 | env:
42 | - name: GET_HOSTS_FROM
43 | value: dns
44 | # If your cluster config does not include a dns service, then to
45 | # instead access environment variables to find service host
46 | # info, comment out the 'value: dns' line above, and uncomment the
47 | # line below:
48 | # value: env
49 | ports:
50 | - containerPort: 80
51 |
--------------------------------------------------------------------------------
/guestbook/all-in-one/redis-slave.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: redis-slave
5 | labels:
6 | app: redis
7 | role: slave
8 | tier: backend
9 | spec:
10 | ports:
11 | - port: 6379
12 | selector:
13 | app: redis
14 | role: slave
15 | tier: backend
16 | ---
17 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
18 | kind: Deployment
19 | metadata:
20 | name: redis-slave
21 | spec:
22 | selector:
23 | matchLabels:
24 | app: redis
25 | role: slave
26 | tier: backend
27 | replicas: 2
28 | template:
29 | metadata:
30 | labels:
31 | app: redis
32 | role: slave
33 | tier: backend
34 | spec:
35 | containers:
36 | - name: slave
37 | image: gcr.io/google_samples/gb-redisslave:v1
38 | resources:
39 | requests:
40 | cpu: 100m
41 | memory: 100Mi
42 | env:
43 | - name: GET_HOSTS_FROM
44 | value: dns
45 | # If your cluster config does not include a dns service, then to
46 | # instead access an environment variable to find the master
47 | # service's host, comment out the 'value: dns' line above, and
48 | # uncomment the line below:
49 | # value: env
50 | ports:
51 | - containerPort: 6379
52 |
--------------------------------------------------------------------------------
/guestbook/frontend-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: frontend
5 | spec:
6 | selector:
7 | matchLabels:
8 | app: guestbook
9 | tier: frontend
10 | replicas: 3
11 | template:
12 | metadata:
13 | labels:
14 | app: guestbook
15 | tier: frontend
16 | spec:
17 | containers:
18 | - name: php-redis
19 | image: gcr.io/google-samples/gb-frontend:v4
20 | resources:
21 | requests:
22 | cpu: 100m
23 | memory: 100Mi
24 | env:
25 | - name: GET_HOSTS_FROM
26 | value: dns
27 | # If your cluster config does not include a dns service, then to
28 | # instead access environment variables to find service host
29 | # info, comment out the 'value: dns' line above, and uncomment the
30 | # line below:
31 | # value: env
32 | ports:
33 | - containerPort: 80
34 |
--------------------------------------------------------------------------------
/guestbook/frontend-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: frontend
5 | labels:
6 | app: guestbook
7 | tier: frontend
8 | spec:
9 | # comment or delete the following line if you want to use a LoadBalancer
10 | type: NodePort
11 | # if your cluster supports it, uncomment the following to automatically create
12 | # an external load-balanced IP for the frontend service.
13 | # type: LoadBalancer
14 | ports:
15 | - port: 80
16 | selector:
17 | app: guestbook
18 | tier: frontend
19 |
--------------------------------------------------------------------------------
/guestbook/legacy/frontend-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: frontend
5 | spec:
6 | replicas: 3
7 | template:
8 | metadata:
9 | labels:
10 | app: guestbook
11 | tier: frontend
12 | spec:
13 | containers:
14 | - name: php-redis
15 | image: gcr.io/google_samples/gb-frontend:v4
16 | resources:
17 | requests:
18 | cpu: 100m
19 | memory: 100Mi
20 | env:
21 | - name: GET_HOSTS_FROM
22 | value: dns
23 | # If your cluster config does not include a dns service, then to
24 | # instead access environment variables to find service host
25 | # info, comment out the 'value: dns' line above, and uncomment the
26 | # line below:
27 | # value: env
28 | ports:
29 | - containerPort: 80
30 |
--------------------------------------------------------------------------------
/guestbook/legacy/redis-master-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: redis-master
5 | labels:
6 | app: redis
7 | role: master
8 | tier: backend
9 | spec:
10 | replicas: 1
11 | template:
12 | metadata:
13 | labels:
14 | app: redis
15 | role: master
16 | tier: backend
17 | spec:
18 | containers:
19 | - name: master
20 | image: k8s.gcr.io/redis:e2e # or just image: redis
21 | resources:
22 | requests:
23 | cpu: 100m
24 | memory: 100Mi
25 | ports:
26 | - containerPort: 6379
27 |
--------------------------------------------------------------------------------
/guestbook/legacy/redis-slave-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: redis-slave
5 | labels:
6 | app: redis
7 | role: slave
8 | tier: backend
9 | spec:
10 | replicas: 2
11 | template:
12 | metadata:
13 | labels:
14 | app: redis
15 | role: slave
16 | tier: backend
17 | spec:
18 | containers:
19 | - name: slave
20 | image: gcr.io/google_samples/gb-redisslave:v1
21 | resources:
22 | requests:
23 | cpu: 100m
24 | memory: 100Mi
25 | env:
26 | - name: GET_HOSTS_FROM
27 | value: dns
28 | # If your cluster config does not include a dns service, then to
29 | # instead access an environment variable to find the master
30 | # service's host, comment out the 'value: dns' line above, and
31 | # uncomment the line below:
32 | # value: env
33 | ports:
34 | - containerPort: 6379
35 |
--------------------------------------------------------------------------------
/guestbook/php-redis/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM php:5-apache
16 |
17 | RUN apt-get update
18 | RUN apt-get install -y php-pear
19 | RUN pear channel-discover pear.nrk.io
20 | RUN pear install nrk/Predis
21 |
22 | # If the container's stdio is connected to systemd-journald,
23 | # /proc/self/fd/{1,2} are Unix sockets and apache will not be able to open()
24 | # them. Use "cat" to write directly to the already opened fds without opening
25 | # them again.
26 | RUN sed -i 's#ErrorLog /proc/self/fd/2#ErrorLog "|$/bin/cat 1>\&2"#' /etc/apache2/apache2.conf
27 | RUN sed -i 's#CustomLog /proc/self/fd/1 combined#CustomLog "|/bin/cat" combined#' /etc/apache2/apache2.conf
28 |
29 | ADD guestbook.php /var/www/html/guestbook.php
30 | ADD controllers.js /var/www/html/controllers.js
31 | ADD index.html /var/www/html/index.html
32 |
--------------------------------------------------------------------------------
/guestbook/php-redis/controllers.js:
--------------------------------------------------------------------------------
1 | var redisApp = angular.module('redis', ['ui.bootstrap']);
2 |
3 | /**
4 | * Constructor
5 | */
6 | function RedisController() {}
7 |
8 | RedisController.prototype.onRedis = function() {
9 | this.scope_.messages.push(this.scope_.msg);
10 | this.scope_.msg = "";
11 | var value = this.scope_.messages.join();
12 | this.http_.get("guestbook.php?cmd=set&key=messages&value=" + value)
13 | .success(angular.bind(this, function(data) {
14 | this.scope_.redisResponse = "Updated.";
15 | }));
16 | };
17 |
18 | redisApp.controller('RedisCtrl', function ($scope, $http, $location) {
19 | $scope.controller = new RedisController();
20 | $scope.controller.scope_ = $scope;
21 | $scope.controller.location_ = $location;
22 | $scope.controller.http_ = $http;
23 |
24 | $scope.controller.http_.get("guestbook.php?cmd=get&key=messages")
25 | .success(function(data) {
26 | console.log(data);
27 | $scope.messages = data.data.split(",");
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/guestbook/php-redis/guestbook.php:
--------------------------------------------------------------------------------
1 | 'tcp',
19 | 'host' => $host,
20 | 'port' => 6379,
21 | ]);
22 |
23 | $client->set($_GET['key'], $_GET['value']);
24 | print('{"message": "Updated"}');
25 | } else {
26 | $host = 'redis-slave';
27 | if (getenv('GET_HOSTS_FROM') == 'env') {
28 | $host = getenv('REDIS_SLAVE_SERVICE_HOST');
29 | }
30 | $client = new Predis\Client([
31 | 'scheme' => 'tcp',
32 | 'host' => $host,
33 | 'port' => 6379,
34 | ]);
35 |
36 | $value = $client->get($_GET['key']);
37 | print('{"data": "' . $value . '"}');
38 | }
39 | } else {
40 | phpinfo();
41 | } ?>
42 |
--------------------------------------------------------------------------------
/guestbook/php-redis/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Guestbook
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Guestbook
12 |
18 |
19 |
20 | {{msg}}
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/guestbook/redis-master-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: redis-master
5 | spec:
6 | selector:
7 | matchLabels:
8 | app: redis
9 | role: master
10 | tier: backend
11 | replicas: 1
12 | template:
13 | metadata:
14 | labels:
15 | app: redis
16 | role: master
17 | tier: backend
18 | spec:
19 | containers:
20 | - name: master
21 | image: k8s.gcr.io/redis:e2e # or just image: redis
22 | resources:
23 | requests:
24 | cpu: 100m
25 | memory: 100Mi
26 | ports:
27 | - containerPort: 6379
28 |
--------------------------------------------------------------------------------
/guestbook/redis-master-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: redis-master
5 | labels:
6 | app: redis
7 | role: master
8 | tier: backend
9 | spec:
10 | ports:
11 | - port: 6379
12 | targetPort: 6379
13 | selector:
14 | app: redis
15 | role: master
16 | tier: backend
17 |
--------------------------------------------------------------------------------
/guestbook/redis-slave-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: redis-slave
5 | spec:
6 | selector:
7 | matchLabels:
8 | app: redis
9 | role: slave
10 | tier: backend
11 | replicas: 2
12 | template:
13 | metadata:
14 | labels:
15 | app: redis
16 | role: slave
17 | tier: backend
18 | spec:
19 | containers:
20 | - name: slave
21 | image: gcr.io/google_samples/gb-redisslave:v1
22 | resources:
23 | requests:
24 | cpu: 100m
25 | memory: 100Mi
26 | env:
27 | - name: GET_HOSTS_FROM
28 | value: dns
29 | # If your cluster config does not include a dns service, then to
30 | # instead access an environment variable to find the master
31 | # service's host, comment out the 'value: dns' line above, and
32 | # uncomment the line below:
33 | # value: env
34 | ports:
35 | - containerPort: 6379
36 |
--------------------------------------------------------------------------------
/guestbook/redis-slave-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: redis-slave
5 | labels:
6 | app: redis
7 | role: slave
8 | tier: backend
9 | spec:
10 | ports:
11 | - port: 6379
12 | selector:
13 | app: redis
14 | role: slave
15 | tier: backend
16 |
--------------------------------------------------------------------------------
/guestbook/redis-slave/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM redis:3.2.9
16 |
17 | COPY run.sh /
18 |
19 | CMD /run.sh
20 |
--------------------------------------------------------------------------------
/guestbook/redis-slave/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2014 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | if [[ ${GET_HOSTS_FROM:-dns} == "env" ]]; then
18 | redis-server --slaveof ${REDIS_MASTER_SERVICE_HOST} 6379
19 | else
20 | redis-server --slaveof redis-master 6379
21 | fi
22 |
--------------------------------------------------------------------------------
/mysql-wordpress-pd/OWNERS:
--------------------------------------------------------------------------------
1 | approvers:
2 | - jeffmendoza
3 | reviewers:
4 | - thockin
5 | - lavalamp
6 | - brendandburns
7 | - caesarxuchao
8 | - mikedanese
9 | - davidopp
10 | - pmorie
11 | - dchen1107
12 | - janetkuo
13 | - roberthbailey
14 | - eparis
15 | - mwielgus
16 | - jlowdermilk
17 | - david-mcmahon
18 | - jeffvance
19 | - jeffmendoza
20 | - RichieEscarez
21 |
--------------------------------------------------------------------------------
/mysql-wordpress-pd/README.md:
--------------------------------------------------------------------------------
1 | # Example: WordPress and MySQL on Kubernetes
2 |
3 | This directory contains the Kubernetes manifest files of the WordPress and
4 | MySQL tutorial for Kubernetes.
5 |
6 | Follow this tutorial at https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/.
7 |
--------------------------------------------------------------------------------
/mysql-wordpress-pd/WordPress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nigelpoulton/k8s-sample-apps/90145b4f11aa6a40a7e376894430438b868dde2d/mysql-wordpress-pd/WordPress.png
--------------------------------------------------------------------------------
/mysql-wordpress-pd/gce-volumes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: wordpress-pv-1
5 | spec:
6 | capacity:
7 | storage: 20Gi
8 | accessModes:
9 | - ReadWriteOnce
10 | gcePersistentDisk:
11 | pdName: wordpress-1
12 | fsType: ext4
13 | ---
14 | apiVersion: v1
15 | kind: PersistentVolume
16 | metadata:
17 | name: wordpress-pv-2
18 | spec:
19 | capacity:
20 | storage: 20Gi
21 | accessModes:
22 | - ReadWriteOnce
23 | gcePersistentDisk:
24 | pdName: wordpress-2
25 | fsType: ext4
26 |
--------------------------------------------------------------------------------
/mysql-wordpress-pd/local-volumes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: local-pv-1
5 | labels:
6 | type: local
7 | spec:
8 | capacity:
9 | storage: 20Gi
10 | accessModes:
11 | - ReadWriteOnce
12 | hostPath:
13 | path: /tmp/data/pv-1
14 | ---
15 | apiVersion: v1
16 | kind: PersistentVolume
17 | metadata:
18 | name: local-pv-2
19 | labels:
20 | type: local
21 | spec:
22 | capacity:
23 | storage: 20Gi
24 | accessModes:
25 | - ReadWriteOnce
26 | hostPath:
27 | path: /tmp/data/pv-2
28 |
--------------------------------------------------------------------------------
/staging/cloud-controller-manager/persistent-volume-label-initializer-config.yaml:
--------------------------------------------------------------------------------
1 | kind: InitializerConfiguration
2 | apiVersion: admissionregistration.k8s.io/v1alpha1
3 | metadata:
4 | name: pvlabel.kubernetes.io
5 | initializers:
6 | - name: pvlabel.kubernetes.io
7 | rules:
8 | - apiGroups:
9 | - ""
10 | apiVersions:
11 | - "*"
12 | resources:
13 | - persistentvolumes
14 |
--------------------------------------------------------------------------------
/staging/cluster-dns/dns-backend-rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: dns-backend
5 | labels:
6 | name: dns-backend
7 | spec:
8 | replicas: 1
9 | selector:
10 | name: dns-backend
11 | template:
12 | metadata:
13 | labels:
14 | name: dns-backend
15 | spec:
16 | containers:
17 | - name: dns-backend
18 | image: k8s.gcr.io/example-dns-backend:v1
19 | ports:
20 | - name: backend-port
21 | containerPort: 8000
22 |
--------------------------------------------------------------------------------
/staging/cluster-dns/dns-backend-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: dns-backend
5 | spec:
6 | ports:
7 | - port: 8000
8 | selector:
9 | name: dns-backend
10 |
--------------------------------------------------------------------------------
/staging/cluster-dns/dns-frontend-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: dns-frontend
5 | labels:
6 | name: dns-frontend
7 | spec:
8 | containers:
9 | - name: dns-frontend
10 | image: k8s.gcr.io/example-dns-frontend:v1
11 | command:
12 | - python
13 | - client.py
14 | - http://dns-backend.development.svc.cluster.local:8000
15 | imagePullPolicy: Always
16 | restartPolicy: Never
17 |
--------------------------------------------------------------------------------
/staging/cluster-dns/images/backend/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM python:2.7-slim
16 |
17 | COPY . /dns-backend
18 | WORKDIR /dns-backend
19 |
20 | CMD ["python", "server.py"]
21 |
--------------------------------------------------------------------------------
/staging/cluster-dns/images/backend/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | TAG = v1
16 | PREFIX = staging-k8s.gcr.io
17 | IMAGE = example-dns-backend
18 |
19 | all: push
20 |
21 | image:
22 | docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) .
23 |
24 | push: image
25 | gcloud docker -- push $(PREFIX)/$(IMAGE)
26 |
27 | clean:
28 |
--------------------------------------------------------------------------------
/staging/cluster-dns/images/backend/server.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
18 |
19 | PORT_NUMBER = 8000
20 |
21 | # This class will handles any incoming request.
22 | class HTTPHandler(BaseHTTPRequestHandler):
23 | # Handler for the GET requests
24 | def do_GET(self):
25 | self.send_response(200)
26 | self.send_header('Content-type','text/html')
27 | self.end_headers()
28 | self.wfile.write("Hello World!")
29 |
30 | try:
31 | # Create a web server and define the handler to manage the incoming request.
32 | server = HTTPServer(('', PORT_NUMBER), HTTPHandler)
33 | print 'Started httpserver on port ' , PORT_NUMBER
34 | server.serve_forever()
35 | except KeyboardInterrupt:
36 | print '^C received, shutting down the web server'
37 | server.socket.close()
38 |
--------------------------------------------------------------------------------
/staging/cluster-dns/images/frontend/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM python:2.7-slim
16 |
17 | RUN pip install requests
18 |
19 | COPY . /dns-frontend
20 | WORKDIR /dns-frontend
21 |
22 | CMD ["python", "client.py"]
23 |
--------------------------------------------------------------------------------
/staging/cluster-dns/images/frontend/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | TAG = v1
16 | PREFIX = staging-k8s.gcr.io
17 | IMAGE = example-dns-frontend
18 |
19 | all: push
20 |
21 | image:
22 | docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) .
23 |
24 | push: image
25 | gcloud docker -- push $(PREFIX)/$(IMAGE)
26 |
27 | clean:
28 |
--------------------------------------------------------------------------------
/staging/cluster-dns/images/frontend/client.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | import argparse
18 | import requests
19 | import socket
20 |
21 | from urlparse import urlparse
22 |
23 |
24 | def CheckServiceAddress(address):
25 | hostname = urlparse(address).hostname
26 | service_address = socket.gethostbyname(hostname)
27 | print service_address
28 |
29 |
30 | def GetServerResponse(address):
31 | print 'Send request to:', address
32 | response = requests.get(address)
33 | print response
34 | print response.content
35 |
36 |
37 | def Main():
38 | parser = argparse.ArgumentParser()
39 | parser.add_argument('address')
40 | args = parser.parse_args()
41 | CheckServiceAddress(args.address)
42 | GetServerResponse(args.address)
43 |
44 |
45 | if __name__ == "__main__":
46 | Main()
47 |
--------------------------------------------------------------------------------
/staging/cluster-dns/namespace-dev.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Namespace
3 | metadata:
4 | name: "development"
5 | labels:
6 | name: "development"
7 |
--------------------------------------------------------------------------------
/staging/cluster-dns/namespace-prod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Namespace
3 | metadata:
4 | name: "production"
5 | labels:
6 | name: "production"
7 |
--------------------------------------------------------------------------------
/staging/cockroachdb/OWNERS:
--------------------------------------------------------------------------------
1 | reviewers:
2 | - a-robinson
3 | approvers:
4 | - a-robinson
5 |
--------------------------------------------------------------------------------
/staging/cpu-manager/OWNERS:
--------------------------------------------------------------------------------
1 | approvers:
2 | - derekwaynecarr
3 | - vishh
4 | - ConnorDoyle
5 | - sjenning
6 | - balajismaniam
7 |
--------------------------------------------------------------------------------
/staging/cpu-manager/be.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: be
5 | spec:
6 | containers:
7 | - image: quay.io/connordoyle/cpuset-visualizer
8 | name: be
9 |
--------------------------------------------------------------------------------
/staging/cpu-manager/exclusive-1.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: exclusive-1
5 | spec:
6 | containers:
7 | - image: quay.io/connordoyle/cpuset-visualizer
8 | name: exclusive-1
9 | resources:
10 | requests:
11 | cpu: 1
12 | memory: "256M"
13 | limits:
14 | cpu: 1
15 | memory: "256M"
16 |
--------------------------------------------------------------------------------
/staging/cpu-manager/exclusive-2.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: exclusive-2
5 | spec:
6 | containers:
7 | - image: quay.io/connordoyle/cpuset-visualizer
8 | name: exclusive-2
9 | resources:
10 | requests:
11 | cpu: 2
12 | memory: "256M"
13 | limits:
14 | cpu: 2
15 | memory: "256M"
16 |
--------------------------------------------------------------------------------
/staging/cpu-manager/exclusive-3.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: exclusive-3
5 | spec:
6 | containers:
7 | - image: quay.io/connordoyle/cpuset-visualizer
8 | name: exclusive-3
9 | resources:
10 | requests:
11 | cpu: 3
12 | memory: "256M"
13 | limits:
14 | cpu: 3
15 | memory: "256M"
16 |
--------------------------------------------------------------------------------
/staging/cpu-manager/exclusive-4.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: exclusive-4
5 | spec:
6 | containers:
7 | - image: quay.io/connordoyle/cpuset-visualizer
8 | name: exclusive-4
9 | resources:
10 | requests:
11 | cpu: 4
12 | memory: "256M"
13 | limits:
14 | cpu: 4
15 | memory: "256M"
16 |
--------------------------------------------------------------------------------
/staging/cpu-manager/pod-ips:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2017 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # Requires `jq`. See https://stedolan.github.io/jq/download
18 |
19 | set -o nounset -o pipefail -o errexit
20 |
21 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
22 | KUBECTL="$DIR/../../cluster/kubectl.sh"
23 | export KUBECONFIG="${KUBECONFIG:-/var/run/kubernetes/admin.kubeconfig}"
24 |
25 | $KUBECTL get pods -o json | \
26 | jq -r '.items[] | "\(.metadata.name) http://\(.status.podIP)"'
27 |
--------------------------------------------------------------------------------
/staging/cpu-manager/shared.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: shared
5 | spec:
6 | containers:
7 | - image: quay.io/connordoyle/cpuset-visualizer
8 | name: shared
9 | resources:
10 | requests:
11 | cpu: 100m
12 |
--------------------------------------------------------------------------------
/staging/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2014 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 | */
16 |
17 | // Examples contains sample applications for trying out the concepts in Kubernetes.
18 | package examples // import "k8s.io/kubernetes/examples"
19 |
--------------------------------------------------------------------------------
/staging/elasticsearch/es-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: elasticsearch
5 | labels:
6 | component: elasticsearch
7 | spec:
8 | type: LoadBalancer
9 | selector:
10 | component: elasticsearch
11 | ports:
12 | - name: http
13 | port: 9200
14 | protocol: TCP
15 | - name: transport
16 | port: 9300
17 | protocol: TCP
18 |
--------------------------------------------------------------------------------
/staging/elasticsearch/production_cluster/es-client-rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: es-client
5 | labels:
6 | component: elasticsearch
7 | role: client
8 | spec:
9 | replicas: 1
10 | template:
11 | metadata:
12 | labels:
13 | component: elasticsearch
14 | role: client
15 | spec:
16 | serviceAccount: elasticsearch
17 | containers:
18 | - name: es-client
19 | securityContext:
20 | capabilities:
21 | add:
22 | - IPC_LOCK
23 | image: quay.io/pires/docker-elasticsearch-kubernetes:1.7.1-4
24 | env:
25 | - name: KUBERNETES_CA_CERTIFICATE_FILE
26 | value: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
27 | - name: NAMESPACE
28 | valueFrom:
29 | fieldRef:
30 | fieldPath: metadata.namespace
31 | - name: "CLUSTER_NAME"
32 | value: "myesdb"
33 | - name: NODE_MASTER
34 | value: "false"
35 | - name: NODE_DATA
36 | value: "false"
37 | - name: HTTP_ENABLE
38 | value: "true"
39 | ports:
40 | - containerPort: 9200
41 | name: http
42 | protocol: TCP
43 | - containerPort: 9300
44 | name: transport
45 | protocol: TCP
46 | volumeMounts:
47 | - mountPath: /data
48 | name: storage
49 | volumes:
50 | - name: storage
51 | emptyDir: {}
52 |
--------------------------------------------------------------------------------
/staging/elasticsearch/production_cluster/es-data-rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: es-data
5 | labels:
6 | component: elasticsearch
7 | role: data
8 | spec:
9 | replicas: 1
10 | template:
11 | metadata:
12 | labels:
13 | component: elasticsearch
14 | role: data
15 | spec:
16 | serviceAccount: elasticsearch
17 | containers:
18 | - name: es-data
19 | securityContext:
20 | capabilities:
21 | add:
22 | - IPC_LOCK
23 | image: quay.io/pires/docker-elasticsearch-kubernetes:1.7.1-4
24 | env:
25 | - name: KUBERNETES_CA_CERTIFICATE_FILE
26 | value: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
27 | - name: NAMESPACE
28 | valueFrom:
29 | fieldRef:
30 | fieldPath: metadata.namespace
31 | - name: "CLUSTER_NAME"
32 | value: "myesdb"
33 | - name: NODE_MASTER
34 | value: "false"
35 | - name: HTTP_ENABLE
36 | value: "false"
37 | ports:
38 | - containerPort: 9300
39 | name: transport
40 | protocol: TCP
41 | volumeMounts:
42 | - mountPath: /data
43 | name: storage
44 | volumes:
45 | - name: storage
46 | emptyDir: {}
47 |
--------------------------------------------------------------------------------
/staging/elasticsearch/production_cluster/es-discovery-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: elasticsearch-discovery
5 | labels:
6 | component: elasticsearch
7 | role: master
8 | spec:
9 | selector:
10 | component: elasticsearch
11 | role: master
12 | ports:
13 | - name: transport
14 | port: 9300
15 | protocol: TCP
16 |
--------------------------------------------------------------------------------
/staging/elasticsearch/production_cluster/es-master-rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: es-master
5 | labels:
6 | component: elasticsearch
7 | role: master
8 | spec:
9 | replicas: 1
10 | template:
11 | metadata:
12 | labels:
13 | component: elasticsearch
14 | role: master
15 | spec:
16 | serviceAccount: elasticsearch
17 | containers:
18 | - name: es-master
19 | securityContext:
20 | capabilities:
21 | add:
22 | - IPC_LOCK
23 | image: quay.io/pires/docker-elasticsearch-kubernetes:1.7.1-4
24 | env:
25 | - name: KUBERNETES_CA_CERTIFICATE_FILE
26 | value: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
27 | - name: NAMESPACE
28 | valueFrom:
29 | fieldRef:
30 | fieldPath: metadata.namespace
31 | - name: "CLUSTER_NAME"
32 | value: "myesdb"
33 | - name: NODE_MASTER
34 | value: "true"
35 | - name: NODE_DATA
36 | value: "false"
37 | - name: HTTP_ENABLE
38 | value: "false"
39 | ports:
40 | - containerPort: 9300
41 | name: transport
42 | protocol: TCP
43 | volumeMounts:
44 | - mountPath: /data
45 | name: storage
46 | volumes:
47 | - name: storage
48 | emptyDir: {}
49 |
--------------------------------------------------------------------------------
/staging/elasticsearch/production_cluster/es-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: elasticsearch
5 | labels:
6 | component: elasticsearch
7 | role: client
8 | spec:
9 | type: LoadBalancer
10 | selector:
11 | component: elasticsearch
12 | role: client
13 | ports:
14 | - name: http
15 | port: 9200
16 | protocol: TCP
17 |
--------------------------------------------------------------------------------
/staging/elasticsearch/production_cluster/service-account.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ServiceAccount
3 | metadata:
4 | name: elasticsearch
5 |
--------------------------------------------------------------------------------
/staging/elasticsearch/rbac.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: Role
4 | metadata:
5 | name: elasticsearch
6 | rules:
7 | - apiGroups:
8 | - ""
9 | resources:
10 | - endpoints
11 | verbs:
12 | - get
13 | ---
14 | apiVersion: rbac.authorization.k8s.io/v1
15 | kind: RoleBinding
16 | metadata:
17 | name: elasticsearch
18 | roleRef:
19 | apiGroup: rbac.authorization.k8s.io
20 | kind: Role
21 | name: elasticsearch
22 | subjects:
23 | - kind: ServiceAccount
24 | name: elasticsearch
25 | namespace: default
26 |
--------------------------------------------------------------------------------
/staging/elasticsearch/service-account.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ServiceAccount
3 | metadata:
4 | name: elasticsearch
5 |
--------------------------------------------------------------------------------
/staging/explorer/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM scratch
16 | ADD explorer explorer
17 | ADD README.md README.md
18 | EXPOSE 8080
19 | ENTRYPOINT ["/explorer"]
20 |
--------------------------------------------------------------------------------
/staging/explorer/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | all: push
16 |
17 | # Keep this one version ahead, so no one accidentally blows away the latest published version.
18 | TAG = 1.1
19 |
20 | explorer: explorer.go
21 | CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./explorer.go
22 |
23 | container: explorer
24 | docker build --pull -t staging-k8s.gcr.io/explorer:$(TAG) .
25 |
26 | push: container
27 | gcloud docker -- push staging-k8s.gcr.io/explorer:$(TAG)
28 |
29 | clean:
30 | rm -f explorer
31 |
--------------------------------------------------------------------------------
/staging/explorer/pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: explorer
5 | spec:
6 | containers:
7 | - name: explorer
8 | image: k8s.gcr.io/explorer:1.0
9 | args: ["-port=8080"]
10 | ports:
11 | - containerPort: 8080
12 | protocol: TCP
13 | volumeMounts:
14 | - mountPath: "/mount/test-volume"
15 | name: test-volume
16 | volumes:
17 | - name: test-volume
18 | emptyDir: {}
19 |
--------------------------------------------------------------------------------
/staging/https-nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM nginx
16 |
17 |
18 | COPY index2.html /usr/share/nginx/html/index2.html
19 | RUN chmod +r /usr/share/nginx/html/index2.html
20 | COPY auto-reload-nginx.sh /home/auto-reload-nginx.sh
21 | RUN chmod +x /home/auto-reload-nginx.sh
22 |
23 | # install inotify
24 | RUN apt-get update && apt-get install -y inotify-tools
25 |
--------------------------------------------------------------------------------
/staging/https-nginx/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | all:
16 |
17 | TAG = 1.0
18 | PREFIX = bprashanth/nginxhttps
19 | KEY = /tmp/nginx.key
20 | CERT = /tmp/nginx.crt
21 | SECRET = /tmp/secret.json
22 |
23 | keys:
24 | # The CName used here is specific to the service specified in nginx-app.yaml.
25 | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $(KEY) -out $(CERT) -subj "/CN=nginxsvc/O=nginxsvc"
26 |
27 | container:
28 | docker build --pull -t $(PREFIX):$(TAG) .
29 |
30 | push: container
31 | docker push $(PREFIX):$(TAG)
32 |
33 | clean:
34 | rm $(KEY)
35 | rm $(CERT)
36 |
--------------------------------------------------------------------------------
/staging/https-nginx/auto-reload-nginx.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Copyright 2016 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | nginx "$@"
18 | oldcksum=`cksum /etc/nginx/conf.d/default.conf`
19 |
20 | inotifywait -e modify,move,create,delete -mr --timefmt '%d/%m/%y %H:%M' --format '%T' \
21 | /etc/nginx/conf.d/ | while read date time; do
22 |
23 | newcksum=`cksum /etc/nginx/conf.d/default.conf`
24 | if [ "$newcksum" != "$oldcksum" ]; then
25 | echo "At ${time} on ${date}, config file update detected."
26 | oldcksum=$newcksum
27 | nginx -s reload
28 | fi
29 |
30 | done
31 |
--------------------------------------------------------------------------------
/staging/https-nginx/default.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80 default_server;
3 | listen [::]:80 default_server ipv6only=on;
4 |
5 | listen 443 ssl;
6 |
7 | root /usr/share/nginx/html;
8 | index index.html;
9 |
10 | server_name localhost;
11 | ssl_certificate /etc/nginx/ssl/tls.crt;
12 | ssl_certificate_key /etc/nginx/ssl/tls.key;
13 |
14 | location / {
15 | try_files $uri $uri/ =404;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/staging/https-nginx/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Nginx reloaded!
5 |
12 |
13 |
14 | Nginx has been reloaded!
15 | If you see this page, the nginx web server has been automatically reloaded, since the config file has been updated using Kubernetes.
16 |
17 |
18 | For online documentation and support please refer to
19 | kubernetes.io.
20 |
21 | For online documentation and support please refer to
22 | nginx.org.
23 | Commercial support is available at
24 | nginx.com.
25 |
26 | Thank you for using nginx.
27 |
28 |
29 |
--------------------------------------------------------------------------------
/staging/https-nginx/nginx-app.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: nginxsvc
5 | labels:
6 | app: nginx
7 | spec:
8 | type: NodePort
9 | ports:
10 | - port: 80
11 | protocol: TCP
12 | name: http
13 | - port: 443
14 | protocol: TCP
15 | name: https
16 | selector:
17 | app: nginx
18 | ---
19 | apiVersion: v1
20 | kind: ReplicationController
21 | metadata:
22 | name: my-nginx
23 | spec:
24 | replicas: 1
25 | template:
26 | metadata:
27 | labels:
28 | app: nginx
29 | spec:
30 | volumes:
31 | - name: secret-volume
32 | secret:
33 | secretName: nginxsecret
34 | - name: configmap-volume
35 | configMap:
36 | name: nginxconfigmap
37 | containers:
38 | - name: nginxhttps
39 | image: ymqytw/nginxhttps:1.5
40 | command: ["/home/auto-reload-nginx.sh"]
41 | ports:
42 | - containerPort: 443
43 | - containerPort: 80
44 | livenessProbe:
45 | httpGet:
46 | path: /index.html
47 | port: 80
48 | initialDelaySeconds: 30
49 | timeoutSeconds: 1
50 | volumeMounts:
51 | - mountPath: /etc/nginx/ssl
52 | name: secret-volume
53 | - mountPath: /etc/nginx/conf.d
54 | name: configmap-volume
55 |
--------------------------------------------------------------------------------
/staging/javaee/mysql-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: mysql-pod
5 | labels:
6 | name: mysql-pod
7 | context: docker-k8s-lab
8 | spec:
9 | containers:
10 | -
11 | name: mysql
12 | image: mysql:latest
13 | env:
14 | -
15 | name: "MYSQL_USER"
16 | value: "mysql"
17 | -
18 | name: "MYSQL_PASSWORD"
19 | value: "mysql"
20 | -
21 | name: "MYSQL_DATABASE"
22 | value: "sample"
23 | -
24 | name: "MYSQL_ROOT_PASSWORD"
25 | value: "supersecret"
26 | ports:
27 | -
28 | containerPort: 3306
29 |
--------------------------------------------------------------------------------
/staging/javaee/mysql-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: mysql-service
5 | labels:
6 | name: mysql-pod
7 | context: docker-k8s-lab
8 | spec:
9 | ports:
10 | # the port that this service should serve on
11 | - port: 3306
12 | # label keys and values that must match in order to receive traffic for this service
13 | selector:
14 | name: mysql-pod
15 | context: docker-k8s-lab
16 |
--------------------------------------------------------------------------------
/staging/javaee/wildfly-rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: wildfly-rc
5 | labels:
6 | name: wildfly
7 | context: docker-k8s-lab
8 | spec:
9 | replicas: 1
10 | template:
11 | metadata:
12 | labels:
13 | name: wildfly
14 | spec:
15 | containers:
16 | - name: wildfly-rc-pod
17 | image: arungupta/wildfly-mysql-javaee7:k8s
18 | ports:
19 | - containerPort: 8080
--------------------------------------------------------------------------------
/staging/javaweb-tomcat-sidecar/javaweb-2.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: javaweb-2
5 | spec:
6 | containers:
7 | - image: resouer/sample:v2
8 | name: war
9 | lifecycle:
10 | postStart:
11 | exec:
12 | command:
13 | - "cp"
14 | - "/sample.war"
15 | - "/app"
16 | volumeMounts:
17 | - mountPath: /app
18 | name: app-volume
19 | - image: resouer/mytomcat:7.0
20 | name: tomcat
21 | command: ["sh","-c","/root/apache-tomcat-7.0.42-v2/bin/start.sh"]
22 | volumeMounts:
23 | - mountPath: /root/apache-tomcat-7.0.42-v2/webapps
24 | name: app-volume
25 | ports:
26 | - containerPort: 8080
27 | hostPort: 8001
28 | volumes:
29 | - name: app-volume
30 | emptyDir: {}
31 |
32 |
--------------------------------------------------------------------------------
/staging/javaweb-tomcat-sidecar/javaweb.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: javaweb
5 | spec:
6 | containers:
7 | - image: resouer/sample:v1
8 | name: war
9 | volumeMounts:
10 | - mountPath: /app
11 | name: app-volume
12 | - image: resouer/mytomcat:7.0
13 | name: tomcat
14 | command: ["sh","-c","/root/apache-tomcat-7.0.42-v2/bin/start.sh"]
15 | volumeMounts:
16 | - mountPath: /root/apache-tomcat-7.0.42-v2/webapps
17 | name: app-volume
18 | ports:
19 | - containerPort: 8080
20 | hostPort: 8001
21 | volumes:
22 | - name: app-volume
23 | emptyDir: {}
24 |
25 |
--------------------------------------------------------------------------------
/staging/javaweb-tomcat-sidecar/workflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nigelpoulton/k8s-sample-apps/90145b4f11aa6a40a7e376894430438b868dde2d/staging/javaweb-tomcat-sidecar/workflow.png
--------------------------------------------------------------------------------
/staging/job/expansions/README.md:
--------------------------------------------------------------------------------
1 |
2 | This file has moved to: http://kubernetes.io/docs/user-guide/jobs/
3 |
4 |
5 |
6 | []()
7 |
8 |
--------------------------------------------------------------------------------
/staging/job/work-queue-1/README.md:
--------------------------------------------------------------------------------
1 |
2 | This file has moved to: http://kubernetes.io/docs/user-guide/jobs/
3 |
4 |
5 |
6 | []()
7 |
8 |
--------------------------------------------------------------------------------
/staging/job/work-queue-2/README.md:
--------------------------------------------------------------------------------
1 |
2 | This file has moved to: http://kubernetes.io/docs/user-guide/jobs/
3 |
4 |
5 |
6 | []()
7 |
8 |
--------------------------------------------------------------------------------
/staging/meteor/dockerbase/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM node:0.10
16 |
17 | ONBUILD WORKDIR /appsrc
18 | ONBUILD COPY . /appsrc
19 |
20 | ONBUILD RUN curl https://install.meteor.com/ | sh && \
21 | meteor build ../app --directory --architecture os.linux.x86_64 && \
22 | rm -rf /appsrc
23 | # TODO rm meteor so it doesn't take space in the image?
24 |
25 | ONBUILD WORKDIR /app/bundle
26 |
27 | ONBUILD RUN (cd programs/server && npm install)
28 | EXPOSE 8080
29 | CMD []
30 | ENV PORT 8080
31 | ENTRYPOINT MONGO_URL=mongodb://$MONGO_SERVICE_HOST:$MONGO_SERVICE_PORT /usr/local/bin/node main.js
32 |
--------------------------------------------------------------------------------
/staging/meteor/dockerbase/README.md:
--------------------------------------------------------------------------------
1 | Building the meteor-kubernetes base image
2 | -----------------------------------------
3 |
4 | As a normal user you don't need to do this since the image is already built and pushed to Docker Hub. You can just use it as a base image. See [this example](https://github.com/Q42/meteor-gke-example/blob/master/Dockerfile).
5 |
6 | To build and push the base meteor-kubernetes image:
7 |
8 | docker build -t chees/meteor-kubernetes .
9 | docker push chees/meteor-kubernetes
10 |
11 |
12 |
13 | []()
14 |
15 |
--------------------------------------------------------------------------------
/staging/meteor/meteor-controller.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "ReplicationController",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "meteor-controller",
6 | "labels": {
7 | "name": "meteor"
8 | }
9 | },
10 | "spec": {
11 | "replicas": 2,
12 | "template": {
13 | "metadata": {
14 | "labels": {
15 | "name": "meteor"
16 | }
17 | },
18 | "spec": {
19 | "containers": [
20 | {
21 | "name": "meteor",
22 | "image": "chees/meteor-gke-example:latest",
23 | "ports": [
24 | {
25 | "name": "http-server",
26 | "containerPort": 8080
27 | }
28 | ]
29 | }
30 | ]
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/staging/meteor/meteor-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Service",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "meteor"
6 | },
7 | "spec": {
8 | "ports": [
9 | {
10 | "port": 80,
11 | "targetPort": "http-server"
12 | }
13 | ],
14 | "selector": {
15 | "name": "meteor"
16 | },
17 | "sessionAffinity": "ClientIP",
18 | "sessionAffinityConfig": {
19 | "clientIP": {
20 | "timeoutSeconds": 90
21 | }
22 | },
23 | "type": "LoadBalancer"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/staging/meteor/mongo-pod.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Pod",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "mongo",
6 | "labels": {
7 | "name": "mongo",
8 | "role": "mongo"
9 | }
10 | },
11 | "spec": {
12 | "volumes": [
13 | {
14 | "name": "mongo-disk",
15 | "gcePersistentDisk": {
16 | "pdName": "mongo-disk",
17 | "fsType": "ext4"
18 | }
19 | }
20 | ],
21 | "containers": [
22 | {
23 | "name": "mongo",
24 | "image": "mongo:latest",
25 | "ports": [
26 | {
27 | "name": "mongo",
28 | "containerPort": 27017
29 | }
30 | ],
31 | "volumeMounts": [
32 | {
33 | "name": "mongo-disk",
34 | "mountPath": "/data/db"
35 | }
36 | ]
37 | }
38 | ]
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/staging/meteor/mongo-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Service",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "mongo",
6 | "labels": {
7 | "name": "mongo"
8 | }
9 | },
10 | "spec": {
11 | "ports": [
12 | {
13 | "port": 27017,
14 | "targetPort": "mongo"
15 | }
16 | ],
17 | "selector": {
18 | "name": "mongo",
19 | "role": "mongo"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/staging/mysql-cinder-pd/mysql-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | name: mysql
6 | name: mysql
7 | spec:
8 | ports:
9 | # the port that this service should serve on
10 | - port: 3306
11 | # label keys and values that must match in order to receive traffic for this service
12 | selector:
13 | name: mysql
--------------------------------------------------------------------------------
/staging/mysql-cinder-pd/mysql.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: mysql
5 | labels:
6 | name: mysql
7 | spec:
8 | containers:
9 | - resources:
10 | limits :
11 | cpu: 0.5
12 | image: mysql
13 | name: mysql
14 | args:
15 | - "--ignore-db-dir"
16 | - "lost+found"
17 | env:
18 | - name: MYSQL_ROOT_PASSWORD
19 | # change this
20 | value: yourpassword
21 | ports:
22 | - containerPort: 3306
23 | name: mysql
24 | volumeMounts:
25 | # name must match the volume name below
26 | - name: mysql-persistent-storage
27 | # mount path within the container
28 | mountPath: /var/lib/mysql
29 | volumes:
30 | - name: mysql-persistent-storage
31 | cinder:
32 | volumeID: bd82f7e2-wece-4c01-a505-4acf60b07f4a
33 | fsType: ext4
34 |
--------------------------------------------------------------------------------
/staging/newrelic-infrastructure/.gitignore:
--------------------------------------------------------------------------------
1 | *.local
2 |
--------------------------------------------------------------------------------
/staging/newrelic-infrastructure/config-to-secret.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2014 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # Encodes the environment variables into a Kubernetes secret.
18 |
19 | BASE64_ENC=$(cat nrconfig.env | base64 | tr -d '\n')
20 | sed -e "s#{{config_data}}#${BASE64_ENC}#g" ./newrelic-config-template.yaml > newrelic-config.yaml
21 |
--------------------------------------------------------------------------------
/staging/newrelic-infrastructure/newrelic-config-template.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: newrelic-config
5 | type: Opaque
6 | data:
7 | config: {{config_data}}
8 |
--------------------------------------------------------------------------------
/staging/newrelic-infrastructure/nrconfig.env:
--------------------------------------------------------------------------------
1 | #--REQUIRED--
2 | # Put your license key in this variable
3 | export NRIA_LICENSE_KEY=REPLACE_LICENSE_KEY_HERE
4 | #
5 | #--OPTIONAL--
6 | # Set to 1 for debug output in the log
7 | export NRIA_VERBOSE=0
8 | # Can log to any file, but will not create directories
9 | export NRIA_LOG_FILE=/var/log/nr-infra.log
10 |
--------------------------------------------------------------------------------
/staging/newrelic/config-to-secret.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2014 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # Encodes the environment variables into a Kubernetes secret.
18 |
19 | BASE64_ENC=$(cat nrconfig.env | base64 | tr -d '\n')
20 | sed -e "s#{{config_data}}#${BASE64_ENC}#g" ./newrelic-config-template.yaml > newrelic-config.yaml
21 |
--------------------------------------------------------------------------------
/staging/newrelic/newrelic-config-template.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: newrelic-config
5 | type: Opaque
6 | data:
7 | config: {{config_data}}
8 |
--------------------------------------------------------------------------------
/staging/newrelic/newrelic-config.yaml:
--------------------------------------------------------------------------------
1 | # This file should be overwritten by ./config-to-secret.sh
2 | # This file is in place to satisfy the kubernetes documentation tests.
3 |
4 | # apiVersion: v1
5 | # kind: Secret
6 | # metadata:
7 | # name: newrelic-config
8 | # type: Opaque
9 | # data:
10 | # config: base64 encoded
11 |
--------------------------------------------------------------------------------
/staging/newrelic/nrconfig.env:
--------------------------------------------------------------------------------
1 | export NRSYSMOND_loglevel=debug
2 | export NRSYSMOND_license_key=REPLACE_LICENSE_KEY_HERE
3 |
--------------------------------------------------------------------------------
/staging/nodesjs-mongodb/mongo-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | labels:
5 | name: mongo
6 | name: mongo-controller
7 | spec:
8 | replicas: 1
9 | template:
10 | metadata:
11 | labels:
12 | name: mongo
13 | spec:
14 | containers:
15 | - image: mongo
16 | name: mongo
17 | ports:
18 | - name: mongo
19 | containerPort: 27017
20 | hostPort: 27017
21 | volumeMounts:
22 | - name: mongo-persistent-storage
23 | mountPath: /data/db
24 | volumes:
25 | - name: mongo-persistent-storage
26 | gcePersistentDisk:
27 | pdName: mongo-disk
28 | fsType: ext4
--------------------------------------------------------------------------------
/staging/nodesjs-mongodb/mongo-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | name: mongo
6 | name: mongo
7 | spec:
8 | ports:
9 | - port: 27017
10 | targetPort: 27017
11 | selector:
12 | name: mongo
--------------------------------------------------------------------------------
/staging/nodesjs-mongodb/web-controller-demo.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | labels:
5 | name: web
6 | name: web-controller
7 | spec:
8 | replicas: 2
9 | selector:
10 | name: web
11 | template:
12 | metadata:
13 | labels:
14 | name: web
15 | spec:
16 | containers:
17 | - image: node:0.10.40
18 | command: ['/bin/sh', '-c']
19 | args: ['cd /home && git clone https://github.com/ijason/NodeJS-Sample-App.git demo && cd demo/EmployeeDB/ && npm install && sed -i -- ''s/localhost/mongo/g'' app.js && node app.js']
20 | name: web
21 | ports:
22 | - containerPort: 3000
23 | name: http-server
--------------------------------------------------------------------------------
/staging/nodesjs-mongodb/web-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | labels:
5 | name: web
6 | name: web-controller
7 | spec:
8 | replicas: 2
9 | selector:
10 | name: web
11 | template:
12 | metadata:
13 | labels:
14 | name: web
15 | spec:
16 | containers:
17 | - image:
18 | name: web
19 | ports:
20 | - containerPort: 3000
21 | name: http-server
--------------------------------------------------------------------------------
/staging/nodesjs-mongodb/web-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: web
5 | labels:
6 | name: web
7 | spec:
8 | type: LoadBalancer
9 | ports:
10 | - port: 80
11 | targetPort: 3000
12 | protocol: TCP
13 | selector:
14 | name: web
--------------------------------------------------------------------------------
/staging/oms/README.md:
--------------------------------------------------------------------------------
1 | # Microsoft Operations Management Suite (OMS) Container Monitoring Example
2 |
3 | This example is deprecated, for up to date instructions, please visit [https://github.com/Microsoft/OMS-docker/tree/master/Kubernetes](https://github.com/Microsoft/OMS-docker/tree/master/Kubernetes).
4 |
--------------------------------------------------------------------------------
/staging/openshift-origin/.gitignore:
--------------------------------------------------------------------------------
1 | config/
2 |
--------------------------------------------------------------------------------
/staging/openshift-origin/etcd-discovery-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: etcd-discovery
5 | spec:
6 | selector:
7 | matchLabels:
8 | name: etcd-discovery
9 | strategy:
10 | type: Recreate
11 | replicas: 1
12 | selector:
13 | matchLabels:
14 | name: etcd-discovery
15 | template:
16 | metadata:
17 | labels:
18 | name: etcd-discovery
19 | spec:
20 | containers:
21 | - name: discovery
22 | image: openshift/etcd-20-centos7
23 | args:
24 | - etcd-discovery.sh
25 | ports:
26 | - containerPort: 2379
27 | protocol: TCP
28 | resources: {}
29 | terminationMessagePath: "/dev/termination-log"
30 | imagePullPolicy: IfNotPresent
31 | securityContext:
32 | capabilities: {}
33 | privileged: false
34 | restartPolicy: Always
35 | dnsPolicy: ClusterFirst
36 | serviceAccount: ''
37 | status: {}
38 |
--------------------------------------------------------------------------------
/staging/openshift-origin/etcd-discovery-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: etcd-discovery
5 | labels:
6 | name: etcd-discovery
7 | spec:
8 | ports:
9 | - protocol: TCP
10 | port: 2379
11 | targetPort: 2379
12 | nodePort: 0
13 | selector:
14 | name: etcd-discovery
15 | sessionAffinity: None
16 | type: ClusterIP
17 | status:
18 | loadBalancer: {}
19 |
--------------------------------------------------------------------------------
/staging/openshift-origin/etcd-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: etcd
5 | labels:
6 | name: etcd
7 | spec:
8 | ports:
9 | - name: client
10 | protocol: TCP
11 | port: 2379
12 | targetPort: 2379
13 | nodePort: 0
14 | - name: server
15 | protocol: TCP
16 | port: 2380
17 | targetPort: 2380
18 | nodePort: 0
19 | selector:
20 | name: etcd
21 | sessionAffinity: None
22 | type: ClusterIP
23 | status:
24 | loadBalancer: {}
25 |
--------------------------------------------------------------------------------
/staging/openshift-origin/openshift-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | name: openshift
6 | name: openshift
7 | spec:
8 | selector:
9 | matchLabels:
10 | name: openshift
11 | replicas: 1
12 | selector:
13 | matchLabels:
14 | name: openshift
15 | template:
16 | metadata:
17 | labels:
18 | name: openshift
19 | spec:
20 | containers:
21 | - args:
22 | - start
23 | - master
24 | - --config=/config/master-config.yaml
25 | image: "openshift/origin"
26 | name: origin
27 | ports:
28 | - containerPort: 8443
29 | name: openshift
30 | volumeMounts:
31 | - mountPath: /config
32 | name: config
33 | readOnly: true
34 | volumes:
35 | - name: config
36 | secret:
37 | secretName: openshift-config
38 |
--------------------------------------------------------------------------------
/staging/openshift-origin/openshift-origin-namespace.yaml:
--------------------------------------------------------------------------------
1 | kind: Namespace
2 | apiVersion: v1
3 | metadata:
4 | name: "openshift-origin"
5 | labels:
6 | name: "openshift-origin"
--------------------------------------------------------------------------------
/staging/openshift-origin/openshift-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: openshift
5 | spec:
6 | ports:
7 | - name: openshift
8 | port: 8443
9 | targetPort: 8443
10 | selector:
11 | name: openshift
12 | type: LoadBalancer
13 |
--------------------------------------------------------------------------------
/staging/openshift-origin/secret.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nigelpoulton/k8s-sample-apps/90145b4f11aa6a40a7e376894430438b868dde2d/staging/openshift-origin/secret.json
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/aws-ebs.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: slow
5 | provisioner: kubernetes.io/aws-ebs
6 | parameters:
7 | type: io1
8 | zone: us-east-1d
9 | iopsPerGB: "10"
10 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/cinder/cinder-storage-class.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: gold
5 | provisioner: kubernetes.io/cinder
6 | parameters:
7 | type: fast
8 | availability: nova
9 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/cinder/example-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: server
5 | spec:
6 | replicas: 1
7 | selector:
8 | role: server
9 | template:
10 | metadata:
11 | labels:
12 | role: server
13 | spec:
14 | containers:
15 | - name: server
16 | image: nginx
17 | volumeMounts:
18 | - mountPath: /var/lib/www/html
19 | name: cinderpvc
20 | volumes:
21 | - name: cinderpvc
22 | persistentVolumeClaim:
23 | claimName: claim1
24 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/claim1.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "PersistentVolumeClaim",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "claim1"
6 | },
7 | "spec": {
8 | "accessModes": [
9 | "ReadWriteOnce"
10 | ],
11 | "resources": {
12 | "requests": {
13 | "storage": "3Gi"
14 | }
15 | },
16 | "storageClassName": "slow"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/gce-pd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: slow
5 | provisioner: kubernetes.io/gce-pd
6 | parameters:
7 | type: pd-standard
8 | zone: us-central1-a
9 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/glusterfs/glusterfs-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: heketi-secret
5 | namespace: default
6 | data:
7 | # base64 encoded password. E.g.: echo -n "mypassword" | base64
8 | key: bXlwYXNzd29yZA==
9 | type: kubernetes.io/glusterfs
10 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/glusterfs/glusterfs-storageclass.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | name: slow
5 | provisioner: kubernetes.io/glusterfs
6 | parameters:
7 | resturl: "http://127.0.0.1:8081"
8 | clusterid: "630372ccdc720a92c681fb928f27b53f"
9 | restuser: "admin"
10 | secretNamespace: "default"
11 | secretName: "heketi-secret"
12 | gidMin: "40000"
13 | gidMax: "50000"
14 | volumetype: "replicate:3"
15 | volumeoptions: "client.ssl on, server.ssl on"
16 | volumenameprefix: "dept-dev"
17 | snapfactor: "10"
18 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/quobyte/example-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: server
5 | spec:
6 | replicas: 1
7 | selector:
8 | role: server
9 | template:
10 | metadata:
11 | labels:
12 | role: server
13 | spec:
14 | containers:
15 | - name: server
16 | image: nginx
17 | volumeMounts:
18 | - mountPath: /var/lib/www/html
19 | name: quobytepvc
20 | volumes:
21 | - name: quobytepvc
22 | persistentVolumeClaim:
23 | claimName: claim1
24 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/quobyte/quobyte-admin-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: quobyte-admin-secret
5 | type: "kubernetes.io/quobyte"
6 | data:
7 | password: cXVvYnl0ZQ==
8 | user: YWRtaW4=
9 | type: kubernetes.io/quobyte
10 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/quobyte/quobyte-storage-class.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | name: slow
5 | provisioner: kubernetes.io/quobyte
6 | parameters:
7 | quobyteAPIServer: "http://138.68.74.142:7860"
8 | registry: "138.68.74.142:7861"
9 | adminSecretName: "quobyte-admin-secret"
10 | adminSecretNamespace: "kube-system"
11 | user: "root"
12 | group: "root"
13 | quobyteConfig: "BASE"
14 | quobyteTenant: "DEFAULT"
15 | createQuota: "False"
16 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/rbd/ceph-secret-admin.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: ceph-secret-admin
5 | type: "kubernetes.io/rbd"
6 | data:
7 | #Please note this value is base64 encoded.
8 | key: QVFEQ1pMdFhPUnQrSmhBQUFYaERWNHJsZ3BsMmNjcDR6RFZST0E9PQ==
9 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/rbd/ceph-secret-user.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: ceph-secret-user
5 | type: "kubernetes.io/rbd"
6 | data:
7 | #Please note this value is base64 encoded.
8 | key: QVFBTWdYaFZ3QkNlRGhBQTlubFBhRnlmVVNhdEdENGRyRldEdlE9PQ==
9 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/rbd/pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: server
5 | spec:
6 | replicas: 1
7 | selector:
8 | role: server
9 | template:
10 | metadata:
11 | labels:
12 | role: server
13 | spec:
14 | containers:
15 | - name: server
16 | image: nginx
17 | volumeMounts:
18 | - mountPath: /var/lib/www/html
19 | name: mypvc
20 | volumes:
21 | - name: mypvc
22 | persistentVolumeClaim:
23 | claimName: claim1
24 |
--------------------------------------------------------------------------------
/staging/persistent-volume-provisioning/rbd/rbd-storage-class.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | name: slow
5 | provisioner: kubernetes.io/rbd
6 | parameters:
7 | monitors: 127.0.0.1:6789
8 | adminId: admin
9 | adminSecretName: ceph-secret-admin
10 | adminSecretNamespace: "kube-system"
11 | pool: kube
12 | userId: kube
13 | userSecretName: ceph-secret-user
14 |
15 |
--------------------------------------------------------------------------------
/staging/phabricator/phabricator-controller.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "ReplicationController",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "phabricator-controller",
6 | "labels": {
7 | "name": "phabricator"
8 | }
9 | },
10 | "spec": {
11 | "replicas": 1,
12 | "selector": {
13 | "name": "phabricator"
14 | },
15 | "template": {
16 | "metadata": {
17 | "labels": {
18 | "name": "phabricator"
19 | }
20 | },
21 | "spec": {
22 | "containers": [
23 | {
24 | "name": "phabricator",
25 | "image": "fgrzadkowski/example-php-phabricator",
26 | "ports": [
27 | {
28 | "name": "http-server",
29 | "containerPort": 80
30 | }
31 | ],
32 | "env": [
33 | {
34 | "name": "MYSQL_SERVICE_IP",
35 | "value": "1.2.3.4"
36 | },
37 | {
38 | "name": "MYSQL_SERVICE_PORT",
39 | "value": "3306"
40 | },
41 | {
42 | "name": "MYSQL_PASSWORD",
43 | "value": "1234"
44 | }
45 | ]
46 | }
47 | ]
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/staging/phabricator/phabricator-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Service",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "phabricator"
6 | },
7 | "spec": {
8 | "ports": [
9 | {
10 | "port": 80,
11 | "targetPort": "http-server"
12 | }
13 | ],
14 | "selector": {
15 | "name": "phabricator"
16 | },
17 | "type": "LoadBalancer"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/staging/phabricator/php-phabricator/000-default.conf:
--------------------------------------------------------------------------------
1 |
2 | Require all granted
3 |
4 |
5 |
6 | DocumentRoot /home/www-data/phabricator/webroot
7 |
8 | RewriteEngine on
9 | RewriteRule ^/rsrc/(.*) - [L,QSA]
10 | RewriteRule ^/favicon.ico - [L,QSA]
11 | RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
12 |
13 |
--------------------------------------------------------------------------------
/staging/phabricator/php-phabricator/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | echo "MySQL host IP ${MYSQL_SERVICE_IP} port ${MYSQL_SERVICE_PORT}."
18 | /home/www-data/phabricator/bin/config set mysql.host $MYSQL_SERVICE_IP
19 | /home/www-data/phabricator/bin/config set mysql.port $MYSQL_SERVICE_PORT
20 | /home/www-data/phabricator/bin/config set mysql.pass $MYSQL_PASSWORD
21 |
22 | echo "Running storage upgrade"
23 | /home/www-data/phabricator/bin/storage --force upgrade || exit 1
24 |
25 | source /etc/apache2/envvars
26 | echo "Starting Apache2"
27 | apache2 -D FOREGROUND
28 |
29 |
--------------------------------------------------------------------------------
/staging/phabricator/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | echo "Create Phabricator replication controller" && kubectl create -f phabricator-controller.json
18 | echo "Create Phabricator service" && kubectl create -f phabricator-service.json
19 | echo "Create firewall rule" && gcloud compute firewall-rules create phabricator-node-80 --allow=tcp:80 --target-tags kubernetes-node
20 |
21 |
--------------------------------------------------------------------------------
/staging/phabricator/teardown.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | echo "Deleting Phabricator service" && kubectl delete -f phabricator-service.json
18 | echo "Deleting Phabricator replication controller" && kubectl delete rc phabricator-controller
19 | echo "Delete firewall rule" && gcloud compute firewall-rules delete -q phabricator-node-80
20 |
21 |
--------------------------------------------------------------------------------
/staging/pod:
--------------------------------------------------------------------------------
1 | # Copy of pod.yaml without file extension for test
2 | apiVersion: v1
3 | kind: Pod
4 | metadata:
5 | name: nginx
6 | labels:
7 | name: nginx
8 | spec:
9 | containers:
10 | - name: nginx
11 | image: nginx
12 | ports:
13 | - containerPort: 80
14 |
--------------------------------------------------------------------------------
/staging/podsecuritypolicy/OWNERS:
--------------------------------------------------------------------------------
1 | approvers:
2 | - deads2k
3 | - ericchiang
4 | - liggitt
5 | - tallclair
6 | reviewers:
7 | - deads2k
8 | - ericchiang
9 | - liggitt
10 | - php-coder
11 | - tallclair
12 |
--------------------------------------------------------------------------------
/staging/podsecuritypolicy/rbac/pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx
5 | labels:
6 | name: nginx
7 | spec:
8 | containers:
9 | - name: nginx
10 | image: nginx
11 | ports:
12 | - containerPort: 80
13 |
--------------------------------------------------------------------------------
/staging/podsecuritypolicy/rbac/pod_priv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx
5 | labels:
6 | name: nginx
7 | spec:
8 | containers:
9 | - name: nginx
10 | image: nginx
11 | ports:
12 | - containerPort: 80
13 | securityContext:
14 | privileged: true
15 |
--------------------------------------------------------------------------------
/staging/podsecuritypolicy/rbac/policies.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: policy/v1beta1
2 | kind: PodSecurityPolicy
3 | metadata:
4 | name: privileged
5 | spec:
6 | fsGroup:
7 | rule: RunAsAny
8 | privileged: true
9 | runAsUser:
10 | rule: RunAsAny
11 | seLinux:
12 | rule: RunAsAny
13 | supplementalGroups:
14 | rule: RunAsAny
15 | volumes:
16 | - '*'
17 | allowedCapabilities:
18 | - '*'
19 | hostPID: true
20 | hostIPC: true
21 | hostNetwork: true
22 | hostPorts:
23 | - min: 1
24 | max: 65536
25 | ---
26 | apiVersion: policy/v1beta1
27 | kind: PodSecurityPolicy
28 | metadata:
29 | name: restricted
30 | spec:
31 | privileged: false
32 | fsGroup:
33 | rule: RunAsAny
34 | runAsUser:
35 | rule: MustRunAsNonRoot
36 | seLinux:
37 | rule: RunAsAny
38 | supplementalGroups:
39 | rule: RunAsAny
40 | volumes:
41 | - 'emptyDir'
42 | - 'secret'
43 | - 'downwardAPI'
44 | - 'configMap'
45 | - 'persistentVolumeClaim'
46 | - 'projected'
47 | hostPID: false
48 | hostIPC: false
49 | hostNetwork: false
50 |
--------------------------------------------------------------------------------
/staging/podsecuritypolicy/rbac/roles.yaml:
--------------------------------------------------------------------------------
1 | # restricted-psp-user grants access to use the restricted PSP.
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRole
4 | metadata:
5 | name: restricted-psp-user
6 | rules:
7 | - apiGroups:
8 | - policy
9 | resources:
10 | - podsecuritypolicies
11 | resourceNames:
12 | - restricted
13 | verbs:
14 | - use
15 | ---
16 | # privileged-psp-user grants access to use the privileged PSP.
17 | apiVersion: rbac.authorization.k8s.io/v1
18 | kind: ClusterRole
19 | metadata:
20 | name: privileged-psp-user
21 | rules:
22 | - apiGroups:
23 | - policy
24 | resources:
25 | - podsecuritypolicies
26 | resourceNames:
27 | - privileged
28 | verbs:
29 | - use
30 |
--------------------------------------------------------------------------------
/staging/scheduler-policy-config-with-extender.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind" : "Policy",
3 | "apiVersion" : "v1",
4 | "extenders" : [
5 | {
6 | "urlPrefix": "http://127.0.0.1:12346/scheduler",
7 | "filterVerb": "filter",
8 | "bindVerb": "bind",
9 | "prioritizeVerb": "prioritize",
10 | "preemptVerb": "preempt",
11 | "weight": 5,
12 | "enableHttps": false,
13 | "nodeCacheCapable": false
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/staging/scheduler-policy-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind" : "Policy",
3 | "apiVersion" : "v1",
4 | "predicates" : [
5 | {"name" : "PodFitsHostPorts"},
6 | {"name" : "PodFitsResources"},
7 | {"name" : "NoDiskConflict"},
8 | {"name" : "NoVolumeZoneConflict"},
9 | {"name" : "MatchNodeSelector"},
10 | {"name" : "HostName"}
11 | ],
12 | "priorities" : [
13 | {"name" : "LeastRequestedPriority", "weight" : 1},
14 | {"name" : "BalancedResourceAllocation", "weight" : 1},
15 | {"name" : "ServiceSpreadingPriority", "weight" : 1},
16 | {"name" : "EqualPriority", "weight" : 1}
17 | ],
18 | "hardPodAffinitySymmetricWeight" : 10,
19 | "alwaysCheckAllPredicates" : false
20 | }
21 |
--------------------------------------------------------------------------------
/staging/selenium/selenium-hub-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: selenium-hub
5 | labels:
6 | app: selenium-hub
7 | spec:
8 | replicas: 1
9 | selector:
10 | matchLabels:
11 | app: selenium-hub
12 | template:
13 | metadata:
14 | labels:
15 | app: selenium-hub
16 | spec:
17 | containers:
18 | - name: selenium-hub
19 | image: selenium/hub:3.11
20 | ports:
21 | - containerPort: 4444
22 | resources:
23 | limits:
24 | memory: "1000Mi"
25 | cpu: ".5"
26 | livenessProbe:
27 | httpGet:
28 | path: /grid/console
29 | port: 4444
30 | initialDelaySeconds: 30
31 | timeoutSeconds: 5
32 | readinessProbe:
33 | httpGet:
34 | path: /grid/console
35 | port: 4444
36 | initialDelaySeconds: 30
37 | timeoutSeconds: 5
38 |
--------------------------------------------------------------------------------
/staging/selenium/selenium-hub-svc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: selenium-hub
5 | labels:
6 | app: selenium-hub
7 | spec:
8 | ports:
9 | - port: 4444
10 | targetPort: 4444
11 | name: port0
12 | selector:
13 | app: selenium-hub
14 | type: NodePort
15 | sessionAffinity: None
16 |
--------------------------------------------------------------------------------
/staging/selenium/selenium-node-chrome-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: selenium-node-chrome
5 | labels:
6 | app: selenium-node-chrome
7 | spec:
8 | replicas: 2
9 | selector:
10 | matchLabels:
11 | app: selenium-node-chrome
12 | template:
13 | metadata:
14 | labels:
15 | app: selenium-node-chrome
16 | spec:
17 | containers:
18 | - name: selenium-node-chrome
19 | image: selenium/node-chrome-debug:3.11
20 | ports:
21 | - containerPort: 5900
22 | env:
23 | - name: HUB_PORT_4444_TCP_ADDR
24 | value: "selenium-hub"
25 | - name: HUB_PORT_4444_TCP_PORT
26 | value: "4444"
27 | resources:
28 | limits:
29 | memory: "1000Mi"
30 | cpu: ".5"
31 |
--------------------------------------------------------------------------------
/staging/selenium/selenium-node-firefox-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: selenium-node-firefox
5 | labels:
6 | app: selenium-node-firefox
7 | spec:
8 | replicas: 2
9 | selector:
10 | matchLabels:
11 | app: selenium-node-firefox
12 | template:
13 | metadata:
14 | labels:
15 | app: selenium-node-firefox
16 | spec:
17 | volumes:
18 | - name: dshm
19 | emptyDir:
20 | medium: Memory
21 | containers:
22 | - name: selenium-node-firefox
23 | image: selenium/node-firefox-debug:3.11
24 | ports:
25 | - containerPort: 5900
26 | volumeMounts:
27 | - mountPath: /dev/shm
28 | name: dshm
29 | env:
30 | - name: HUB_PORT_4444_TCP_ADDR
31 | value: "selenium-hub"
32 | - name: HUB_PORT_4444_TCP_PORT
33 | value: "4444"
34 | resources:
35 | limits:
36 | memory: "1000Mi"
37 | cpu: ".5"
38 |
--------------------------------------------------------------------------------
/staging/selenium/selenium-test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | from selenium import webdriver
18 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
19 |
20 | def check_browser(browser):
21 | driver = webdriver.Remote(
22 | command_executor='http://selenium-hub:4444/wd/hub',
23 | desired_capabilities=getattr(DesiredCapabilities, browser)
24 | )
25 | driver.get("http://google.com")
26 | assert "google" in driver.page_source
27 | driver.close()
28 | print("Browser %s checks out!" % browser)
29 |
30 |
31 | check_browser("FIREFOX")
32 | check_browser("CHROME")
33 |
34 |
--------------------------------------------------------------------------------
/staging/spark/namespace-spark-cluster.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Namespace
3 | metadata:
4 | name: "spark-cluster"
5 | labels:
6 | name: "spark-cluster"
7 |
--------------------------------------------------------------------------------
/staging/spark/spark-gluster/glusterfs-endpoints.yaml:
--------------------------------------------------------------------------------
1 | kind: Endpoints
2 | apiVersion: v1
3 | metadata:
4 | name: glusterfs-cluster
5 | namespace: spark-cluster
6 | subsets:
7 | - addresses:
8 | - ip: 192.168.30.104
9 | ports:
10 | - port: 1
11 | - addresses:
12 | - ip: 192.168.30.105
13 | ports:
14 | - port: 1
15 |
--------------------------------------------------------------------------------
/staging/spark/spark-gluster/spark-master-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: spark-master-controller
5 | namespace: spark-cluster
6 | labels:
7 | component: spark-master
8 | spec:
9 | replicas: 1
10 | selector:
11 | component: spark-master
12 | template:
13 | metadata:
14 | labels:
15 | component: spark-master
16 | spec:
17 | containers:
18 | - name: spark-master
19 | image: k8s.gcr.io/spark:1.5.2_v1
20 | command: ["/start-master"]
21 | ports:
22 | - containerPort: 7077
23 | volumeMounts:
24 | - mountPath: /mnt/glusterfs
25 | name: glusterfsvol
26 | resources:
27 | requests:
28 | cpu: 100m
29 | volumes:
30 | - name: glusterfsvol
31 | glusterfs:
32 | endpoints: glusterfs-cluster
33 | path: MyVolume
34 | readOnly: false
35 |
--------------------------------------------------------------------------------
/staging/spark/spark-gluster/spark-master-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: spark-master
5 | namespace: spark-cluster
6 | labels:
7 | component: spark-master-service
8 | spec:
9 | ports:
10 | - port: 7077
11 | targetPort: 7077
12 | selector:
13 | component: spark-master
14 |
--------------------------------------------------------------------------------
/staging/spark/spark-gluster/spark-worker-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: spark-gluster-worker-controller
5 | namespace: spark-cluster
6 | labels:
7 | component: spark-worker
8 | spec:
9 | replicas: 2
10 | selector:
11 | component: spark-worker
12 | template:
13 | metadata:
14 | labels:
15 | component: spark-worker
16 | uses: spark-master
17 | spec:
18 | containers:
19 | - name: spark-worker
20 | image: k8s.gcr.io/spark:1.5.2_v1
21 | command: ["/start-worker"]
22 | ports:
23 | - containerPort: 8888
24 | volumeMounts:
25 | - mountPath: /mnt/glusterfs
26 | name: glusterfsvol
27 | resources:
28 | requests:
29 | cpu: 100m
30 | volumes:
31 | - name: glusterfsvol
32 | glusterfs:
33 | endpoints: glusterfs-cluster
34 | path: MyVolume
35 | readOnly: false
36 |
--------------------------------------------------------------------------------
/staging/spark/spark-master-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: spark-master-controller
5 | spec:
6 | replicas: 1
7 | selector:
8 | component: spark-master
9 | template:
10 | metadata:
11 | labels:
12 | component: spark-master
13 | spec:
14 | containers:
15 | - name: spark-master
16 | image: k8s.gcr.io/spark:1.5.2_v1
17 | command: ["/start-master"]
18 | ports:
19 | - containerPort: 7077
20 | - containerPort: 8080
21 | resources:
22 | requests:
23 | cpu: 100m
24 |
--------------------------------------------------------------------------------
/staging/spark/spark-master-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: spark-master
5 | spec:
6 | ports:
7 | - port: 7077
8 | targetPort: 7077
9 | name: spark
10 | - port: 8080
11 | targetPort: 8080
12 | name: http
13 | selector:
14 | component: spark-master
15 |
--------------------------------------------------------------------------------
/staging/spark/spark-ui-proxy-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: spark-ui-proxy-controller
5 | spec:
6 | replicas: 1
7 | selector:
8 | component: spark-ui-proxy
9 | template:
10 | metadata:
11 | labels:
12 | component: spark-ui-proxy
13 | spec:
14 | containers:
15 | - name: spark-ui-proxy
16 | image: elsonrodriguez/spark-ui-proxy:1.0
17 | ports:
18 | - containerPort: 80
19 | resources:
20 | requests:
21 | cpu: 100m
22 | args:
23 | - spark-master:8080
24 | livenessProbe:
25 | httpGet:
26 | path: /
27 | port: 80
28 | initialDelaySeconds: 120
29 | timeoutSeconds: 5
30 |
--------------------------------------------------------------------------------
/staging/spark/spark-ui-proxy-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: spark-ui-proxy
5 | spec:
6 | ports:
7 | - port: 80
8 | targetPort: 80
9 | selector:
10 | component: spark-ui-proxy
11 | type: LoadBalancer
12 |
--------------------------------------------------------------------------------
/staging/spark/spark-worker-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: spark-worker-controller
5 | spec:
6 | replicas: 2
7 | selector:
8 | component: spark-worker
9 | template:
10 | metadata:
11 | labels:
12 | component: spark-worker
13 | spec:
14 | containers:
15 | - name: spark-worker
16 | image: k8s.gcr.io/spark:1.5.2_v1
17 | command: ["/start-worker"]
18 | ports:
19 | - containerPort: 8081
20 | resources:
21 | requests:
22 | cpu: 100m
23 |
24 |
--------------------------------------------------------------------------------
/staging/spark/zeppelin-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: zeppelin-controller
5 | spec:
6 | replicas: 1
7 | selector:
8 | component: zeppelin
9 | template:
10 | metadata:
11 | labels:
12 | component: zeppelin
13 | spec:
14 | containers:
15 | - name: zeppelin
16 | image: k8s.gcr.io/zeppelin:v0.5.6_v1
17 | ports:
18 | - containerPort: 8080
19 | resources:
20 | requests:
21 | cpu: 100m
22 |
--------------------------------------------------------------------------------
/staging/spark/zeppelin-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: zeppelin
5 | spec:
6 | ports:
7 | - port: 80
8 | targetPort: 8080
9 | selector:
10 | component: zeppelin
11 | type: LoadBalancer
12 |
--------------------------------------------------------------------------------
/staging/storage/hazelcast/hazelcast-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: hazelcast
5 | labels:
6 | name: hazelcast
7 | spec:
8 | selector:
9 | matchLabels:
10 | name: hazelcast
11 | template:
12 | metadata:
13 | labels:
14 | name: hazelcast
15 | spec:
16 | containers:
17 | - name: hazelcast
18 | image: quay.io/pires/hazelcast-kubernetes:3.8_1
19 | imagePullPolicy: Always
20 | env:
21 | - name: "DNS_DOMAIN"
22 | value: "cluster.local"
23 | - name: POD_NAMESPACE
24 | valueFrom:
25 | fieldRef:
26 | fieldPath: metadata.namespace
27 | ports:
28 | - name: hazelcast
29 | containerPort: 5701
30 |
--------------------------------------------------------------------------------
/staging/storage/hazelcast/hazelcast-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | name: hazelcast
6 | name: hazelcast
7 | spec:
8 | ports:
9 | - port: 5701
10 | selector:
11 | name: hazelcast
12 |
--------------------------------------------------------------------------------
/staging/storage/minio/minio-distributed-headless-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: minio
5 | labels:
6 | app: minio
7 | spec:
8 | clusterIP: None
9 | ports:
10 | - port: 9000
11 | name: minio
12 | selector:
13 | app: minio
14 |
--------------------------------------------------------------------------------
/staging/storage/minio/minio-distributed-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: minio-service
5 | spec:
6 | type: LoadBalancer
7 | ports:
8 | - port: 9000
9 | targetPort: 9000
10 | protocol: TCP
11 | selector:
12 | app: minio
13 |
--------------------------------------------------------------------------------
/staging/storage/minio/minio-standalone-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | # This name uniquely identifies the Deployment
5 | name: minio-deployment
6 | spec:
7 | selector:
8 | matchLabels:
9 | app: minio
10 | strategy:
11 | type: Recreate
12 | template:
13 | metadata:
14 | labels:
15 | # Label is used as selector in the service.
16 | app: minio
17 | spec:
18 | # Refer to the PVC created earlier
19 | volumes:
20 | - name: storage
21 | persistentVolumeClaim:
22 | # Name of the PVC created earlier
23 | claimName: minio-pv-claim
24 | containers:
25 | - name: minio
26 | # Pulls the default Minio image from Docker Hub
27 | image: minio/minio:latest
28 | args:
29 | - server
30 | - /storage
31 | env:
32 | # Minio access key and secret key
33 | - name: MINIO_ACCESS_KEY
34 | value: "minio"
35 | - name: MINIO_SECRET_KEY
36 | value: "minio123"
37 | ports:
38 | - containerPort: 9000
39 | hostPort: 9000
40 | # Mount the volume into the pod
41 | volumeMounts:
42 | - name: storage # must match the volume name, above
43 | mountPath: "/storage"
44 |
--------------------------------------------------------------------------------
/staging/storage/minio/minio-standalone-pvc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | # This name uniquely identifies the PVC. Will be used in deployment below.
5 | name: minio-pv-claim
6 | labels:
7 | app: minio-storage-claim
8 | spec:
9 | # Read more about access modes here: http://kubernetes.io/docs/user-guide/persistent-volumes/#access-modes
10 | accessModes:
11 | - ReadWriteOnce
12 | storageClassName: standard
13 | resources:
14 | # This is the request for storage. Should be available in the cluster.
15 | requests:
16 | storage: 10Gi
17 |
--------------------------------------------------------------------------------
/staging/storage/minio/minio-standalone-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: minio-service
5 | spec:
6 | type: LoadBalancer
7 | ports:
8 | - port: 9000
9 | targetPort: 9000
10 | protocol: TCP
11 | selector:
12 | app: minio
13 |
--------------------------------------------------------------------------------
/staging/storage/mysql-galera/image/cluster.cnf:
--------------------------------------------------------------------------------
1 | [mysqld]
2 |
3 | wsrep_provider=/usr/lib/libgalera_smm.so
4 | wsrep_cluster_address=gcomm://
5 | binlog_format=ROW
6 | default_storage_engine=InnoDB
7 | innodb_autoinc_lock_mode=2
8 |
9 | wsrep_sst_method=xtrabackup-v2
10 | wsrep_node_address=127.0.0.1
11 | wsrep_cluster_name=galera_kubernetes
12 | wsrep_sst_auth=sstuser:changethis
13 |
--------------------------------------------------------------------------------
/staging/storage/mysql-galera/image/my.cnf:
--------------------------------------------------------------------------------
1 | [client]
2 | port=3306
3 | socket=/var/run/mysqld/mysqld.sock
4 |
5 | [mysqld_safe]
6 | socket=/var/run/mysqld/mysqld.sock
7 | nice=0
8 |
9 | [mysqld]
10 | user=mysql
11 | pid-file=/var/run/mysqld/mysqld.pid
12 | socket=/var/run/mysqld/mysqld.sock
13 | port=3306
14 | basedir=/usr
15 | datadir=/var/lib/mysql
16 | tmpdir=/tmp
17 | lc-messages-dir=/usr/share/mysql
18 | skip-external-locking
19 |
20 | key_buffer=16M
21 | max_allowed_packet=16M
22 | thread_stack=192K
23 | thread_cache_size=8
24 |
25 | myisam-recover=BACKUP
26 | #max_connections=100
27 | query_cache_limit=1M
28 | query_cache_size=16M
29 | slow_query_log=1
30 | slow_query_log_file=/var/log/mysql/mysql-slow.log
31 | long_query_time=2
32 | log-queries-not-using-indexes
33 |
34 | server-id=12345
35 | log_bin=/var/log/mysql/mysql-bin.log
36 | expire_logs_days=4
37 | max_binlog_size=100M
38 |
39 | default_storage_engine=InnoDB
40 | innodb_file_per_table
41 | innodb_log_file_size=100M
42 | innodb_log_buffer_size=10M
43 | innodb_log_files_in_group=2
44 | innodb_buffer_pool_instances=4
45 | innodb_buffer_pool_size=100M
46 |
47 | [mysqldump]
48 | quick
49 | quote-names
50 | max_allowed_packet=16M
51 |
52 | [isamchk]
53 | key_buffer=16M
54 |
55 | !includedir /etc/mysql/conf.d/
56 |
--------------------------------------------------------------------------------
/staging/storage/mysql-galera/pxc-cluster-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: pxc-cluster
5 | labels:
6 | unit: pxc-cluster
7 | spec:
8 | ports:
9 | - port: 3306
10 | name: mysql
11 | selector:
12 | unit: pxc-cluster
--------------------------------------------------------------------------------
/staging/storage/redis/image/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM alpine:3.4
16 |
17 | RUN apk add --no-cache redis sed bash
18 |
19 | COPY redis-master.conf /redis-master/redis.conf
20 | COPY redis-slave.conf /redis-slave/redis.conf
21 | COPY run.sh /run.sh
22 |
23 | CMD [ "/run.sh" ]
24 |
25 | ENTRYPOINT [ "bash", "-c" ]
26 |
--------------------------------------------------------------------------------
/staging/storage/redis/redis-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: redis
5 | spec:
6 | replicas: 1
7 | selector:
8 | name: redis
9 | template:
10 | metadata:
11 | labels:
12 | name: redis
13 | role: master
14 | spec:
15 | containers:
16 | - name: redis
17 | image: k8s.gcr.io/redis:v1
18 | ports:
19 | - containerPort: 6379
20 | resources:
21 | limits:
22 | cpu: "0.1"
23 | volumeMounts:
24 | - mountPath: /redis-master-data
25 | name: data
26 | volumes:
27 | - name: data
28 |
--------------------------------------------------------------------------------
/staging/storage/redis/redis-master.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | labels:
5 | name: redis
6 | redis-sentinel: "true"
7 | role: master
8 | name: redis-master
9 | spec:
10 | containers:
11 | - name: master
12 | image: k8s.gcr.io/redis:v1
13 | env:
14 | - name: MASTER
15 | value: "true"
16 | ports:
17 | - containerPort: 6379
18 | resources:
19 | limits:
20 | cpu: "0.1"
21 | volumeMounts:
22 | - mountPath: /redis-master-data
23 | name: data
24 | - name: sentinel
25 | image: kubernetes/redis:v1
26 | env:
27 | - name: SENTINEL
28 | value: "true"
29 | ports:
30 | - containerPort: 26379
31 | volumes:
32 | - name: data
33 | emptyDir: {}
34 |
--------------------------------------------------------------------------------
/staging/storage/redis/redis-sentinel-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: redis-sentinel
5 | spec:
6 | replicas: 1
7 | selector:
8 | redis-sentinel: "true"
9 | template:
10 | metadata:
11 | labels:
12 | name: redis-sentinel
13 | redis-sentinel: "true"
14 | role: sentinel
15 | spec:
16 | containers:
17 | - name: sentinel
18 | image: k8s.gcr.io/redis:v1
19 | env:
20 | - name: SENTINEL
21 | value: "true"
22 | ports:
23 | - containerPort: 26379
24 |
--------------------------------------------------------------------------------
/staging/storage/redis/redis-sentinel-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | name: sentinel
6 | role: service
7 | name: redis-sentinel
8 | spec:
9 | ports:
10 | - port: 26379
11 | targetPort: 26379
12 | selector:
13 | redis-sentinel: "true"
14 |
--------------------------------------------------------------------------------
/staging/storage/rethinkdb/admin-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | labels:
5 | db: rethinkdb
6 | role: admin
7 | name: rethinkdb-admin
8 | spec:
9 | containers:
10 | - image: k8s.gcr.io/rethinkdb:1.16.0_1
11 | name: rethinkdb
12 | env:
13 | - name: POD_NAMESPACE
14 | valueFrom:
15 | fieldRef:
16 | fieldPath: metadata.namespace
17 | ports:
18 | - containerPort: 8080
19 | name: admin-port
20 | - containerPort: 28015
21 | name: driver-port
22 | - containerPort: 29015
23 | name: cluster-port
24 | volumeMounts:
25 | - mountPath: /data/rethinkdb_data
26 | name: rethinkdb-storage
27 | volumes:
28 | - name: rethinkdb-storage
29 | emptyDir: {}
30 |
--------------------------------------------------------------------------------
/staging/storage/rethinkdb/admin-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | db: rethinkdb
6 | name: rethinkdb-admin
7 | spec:
8 | ports:
9 | - port: 8080
10 | targetPort: 8080
11 | type: LoadBalancer
12 | selector:
13 | db: rethinkdb
14 | role: admin
15 |
--------------------------------------------------------------------------------
/staging/storage/rethinkdb/driver-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | db: rethinkdb
6 | name: rethinkdb-driver
7 | spec:
8 | ports:
9 | - port: 28015
10 | targetPort: 28015
11 | selector:
12 | db: rethinkdb
13 |
--------------------------------------------------------------------------------
/staging/storage/rethinkdb/image/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM rethinkdb:1.16.0
16 |
17 |
18 | RUN apt-get update && \
19 | apt-get install -yq curl && \
20 | rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/* && \
21 | curl -L http://stedolan.github.io/jq/download/linux64/jq > /usr/bin/jq && \
22 | chmod u+x /usr/bin/jq
23 |
24 | COPY ./run.sh /usr/bin/run.sh
25 | RUN chmod u+x /usr/bin/run.sh
26 |
27 | CMD "/usr/bin/run.sh"
28 |
--------------------------------------------------------------------------------
/staging/storage/rethinkdb/rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | labels:
5 | db: rethinkdb
6 | name: rethinkdb-rc
7 | spec:
8 | replicas: 1
9 | selector:
10 | db: rethinkdb
11 | role: replicas
12 | template:
13 | metadata:
14 | labels:
15 | db: rethinkdb
16 | role: replicas
17 | spec:
18 | containers:
19 | - image: k8s.gcr.io/rethinkdb:1.16.0_1
20 | name: rethinkdb
21 | env:
22 | - name: POD_NAMESPACE
23 | valueFrom:
24 | fieldRef:
25 | fieldPath: metadata.namespace
26 | ports:
27 | - containerPort: 8080
28 | name: admin-port
29 | - containerPort: 28015
30 | name: driver-port
31 | - containerPort: 29015
32 | name: cluster-port
33 | volumeMounts:
34 | - mountPath: /data/rethinkdb_data
35 | name: rethinkdb-storage
36 | volumes:
37 | - name: rethinkdb-storage
38 | emptyDir: {}
39 |
--------------------------------------------------------------------------------
/staging/storage/vitess/create_test_table.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE messages (
2 | page BIGINT(20) UNSIGNED,
3 | time_created_ns BIGINT(20) UNSIGNED,
4 | keyspace_id BIGINT(20) UNSIGNED,
5 | message VARCHAR(10000),
6 | PRIMARY KEY (page, time_created_ns)
7 | ) ENGINE=InnoDB
8 |
9 |
--------------------------------------------------------------------------------
/staging/storage/vitess/etcd-down.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that tears down the etcd servers started by
18 | # etcd-up.sh.
19 |
20 | set -e
21 |
22 | script_root=`dirname "${BASH_SOURCE}"`
23 | source $script_root/env.sh
24 |
25 | CELLS=${CELLS:-'test'}
26 | cells=`echo $CELLS | tr ',' ' '`
27 |
28 | # Delete replication controllers
29 | for cell in 'global' $cells; do
30 | echo "Deleting etcd replicationcontroller for $cell cell..."
31 | $KUBECTL delete replicationcontroller etcd-$cell
32 |
33 | echo "Deleting etcd service for $cell cell..."
34 | $KUBECTL delete service etcd-$cell
35 | done
36 |
37 |
--------------------------------------------------------------------------------
/staging/storage/vitess/etcd-service-template.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: etcd-{{cell}}
5 | labels:
6 | component: etcd
7 | cell: {{cell}}
8 | app: vitess
9 | spec:
10 | ports:
11 | - port: 4001
12 | selector:
13 | component: etcd
14 | cell: {{cell}}
15 | app: vitess
16 |
17 |
--------------------------------------------------------------------------------
/staging/storage/vitess/guestbook-controller.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: guestbook
5 | spec:
6 | replicas: 3
7 | template:
8 | metadata:
9 | labels:
10 | component: guestbook
11 | app: vitess
12 | spec:
13 | containers:
14 | - name: guestbook
15 | image: vitess/guestbook:v2.0.0-alpha5
16 | ports:
17 | - name: http-server
18 | containerPort: 8080
19 | resources:
20 | limits:
21 | memory: "128Mi"
22 | cpu: "100m"
23 |
24 |
--------------------------------------------------------------------------------
/staging/storage/vitess/guestbook-down.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that stops guestbook.
18 |
19 | set -e
20 |
21 | script_root=`dirname "${BASH_SOURCE}"`
22 | source $script_root/env.sh
23 |
24 | echo "Deleting guestbook replicationcontroller..."
25 | $KUBECTL delete replicationcontroller guestbook
26 |
27 | echo "Deleting guestbook service..."
28 | $KUBECTL delete service guestbook
29 |
--------------------------------------------------------------------------------
/staging/storage/vitess/guestbook-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: guestbook
5 | labels:
6 | component: guestbook
7 | app: vitess
8 | spec:
9 | ports:
10 | - port: 80
11 | targetPort: http-server
12 | selector:
13 | component: guestbook
14 | app: vitess
15 | type: LoadBalancer
16 |
17 |
--------------------------------------------------------------------------------
/staging/storage/vitess/guestbook-up.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that starts a guestbook replicationcontroller.
18 |
19 | set -e
20 |
21 | script_root=`dirname "${BASH_SOURCE}"`
22 | source $script_root/env.sh
23 |
24 | echo "Creating guestbook service..."
25 | $KUBECTL create -f guestbook-service.yaml
26 |
27 | echo "Creating guestbook replicationcontroller..."
28 | $KUBECTL create -f guestbook-controller.yaml
29 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vitess-down.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | script_root=`dirname "${BASH_SOURCE}"`
18 | source $script_root/env.sh
19 |
20 | ./vtgate-down.sh
21 | SHARDS=$SHARDS CELLS=$CELLS TABLETS_PER_SHARD=$TABLETS_PER_SHARD ./vttablet-down.sh
22 | ./vtctld-down.sh
23 | ./etcd-down.sh
24 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtctld-down.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that stops vtctld.
18 |
19 | set -e
20 |
21 | script_root=`dirname "${BASH_SOURCE}"`
22 | source $script_root/env.sh
23 |
24 | echo "Deleting vtctld replicationcontroller..."
25 | $KUBECTL delete replicationcontroller vtctld
26 |
27 | echo "Deleting vtctld service..."
28 | $KUBECTL delete service vtctld
29 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtctld-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: vtctld
5 | labels:
6 | component: vtctld
7 | app: vitess
8 | spec:
9 | ports:
10 | - port: 15000
11 | name: web
12 | targetPort: 15000
13 | nodePort: 30000
14 | - port: 15001
15 | name: grpc
16 | targetPort: 15001
17 | nodePort: 30001
18 | selector:
19 | component: vtctld
20 | app: vitess
21 | type: NodePort
22 |
23 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtctld-up.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that starts vtctld.
18 |
19 | set -e
20 |
21 | script_root=`dirname "${BASH_SOURCE}"`
22 | source $script_root/env.sh
23 |
24 | echo "Creating vtctld service..."
25 | $KUBECTL create -f vtctld-service.yaml
26 |
27 | echo "Creating vtctld replicationcontroller..."
28 | # Expand template variables
29 | sed_script=""
30 | for var in backup_flags; do
31 | sed_script+="s,{{$var}},${!var},g;"
32 | done
33 |
34 | # Instantiate template and send to kubectl.
35 | cat vtctld-controller-template.yaml | sed -e "$sed_script" | $KUBECTL create -f -
36 |
37 | server=$(get_vtctld_addr)
38 | echo
39 | echo "vtctld address: http://$server"
40 |
41 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtgate-controller-template.yaml:
--------------------------------------------------------------------------------
1 | kind: ReplicationController
2 | apiVersion: v1
3 | metadata:
4 | name: vtgate
5 | spec:
6 | replicas: {{replicas}}
7 | template:
8 | metadata:
9 | labels:
10 | component: vtgate
11 | app: vitess
12 | spec:
13 | containers:
14 | - name: vtgate
15 | image: vitess/lite:v2.0.0-alpha5
16 | volumeMounts:
17 | - name: syslog
18 | mountPath: /dev/log
19 | - name: vtdataroot
20 | mountPath: /vt/vtdataroot
21 | resources:
22 | limits:
23 | memory: "512Mi"
24 | cpu: "500m"
25 | command:
26 | - sh
27 | - "-c"
28 | - >-
29 | mkdir -p $VTDATAROOT/tmp &&
30 | chown -R vitess /vt &&
31 | su -p -c "/vt/bin/vtgate
32 | -topo_implementation etcd
33 | -etcd_global_addrs http://$ETCD_GLOBAL_SERVICE_HOST:$ETCD_GLOBAL_SERVICE_PORT
34 | -log_dir $VTDATAROOT/tmp
35 | -alsologtostderr
36 | -port 15001
37 | -tablet_protocol grpc
38 | -service_map 'bsonrpc-vt-vtgateservice'
39 | -cell test" vitess
40 | volumes:
41 | - name: syslog
42 | hostPath: {path: /dev/log}
43 | - name: vtdataroot
44 | emptyDir: {}
45 |
46 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtgate-down.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that stops vtgate.
18 |
19 | set -e
20 |
21 | script_root=`dirname "${BASH_SOURCE}"`
22 | source $script_root/env.sh
23 |
24 | echo "Deleting vtgate replicationcontroller..."
25 | $KUBECTL delete replicationcontroller vtgate
26 |
27 | echo "Deleting vtgate service..."
28 | $KUBECTL delete service vtgate
29 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtgate-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: vtgate
5 | labels:
6 | component: vtgate
7 | app: vitess
8 | spec:
9 | ports:
10 | - port: 15001
11 | selector:
12 | component: vtgate
13 | app: vitess
14 | type: LoadBalancer
15 |
16 |
--------------------------------------------------------------------------------
/staging/storage/vitess/vtgate-up.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Copyright 2015 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # This is an example script that starts a vtgate replicationcontroller.
18 |
19 | set -e
20 |
21 | script_root=`dirname "${BASH_SOURCE}"`
22 | source $script_root/env.sh
23 |
24 | VTGATE_REPLICAS=${VTGATE_REPLICAS:-3}
25 | VTGATE_TEMPLATE=${VTGATE_TEMPLATE:-'vtgate-controller-template.yaml'}
26 |
27 | replicas=$VTGATE_REPLICAS
28 |
29 | echo "Creating vtgate service..."
30 | $KUBECTL create -f vtgate-service.yaml
31 |
32 | sed_script=""
33 | for var in replicas; do
34 | sed_script+="s,{{$var}},${!var},g;"
35 | done
36 |
37 | echo "Creating vtgate replicationcontroller..."
38 | cat $VTGATE_TEMPLATE | sed -e "$sed_script" | $KUBECTL create -f -
39 |
--------------------------------------------------------------------------------
/staging/storm/storm-nimbus-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Service",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "nimbus",
6 | "labels": {
7 | "name": "nimbus"
8 | }
9 | },
10 | "spec": {
11 | "ports": [
12 | {
13 | "port": 6627
14 | }
15 | ],
16 | "selector": {
17 | "name": "nimbus"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/staging/storm/storm-nimbus.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Pod",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "nimbus",
6 | "labels": {
7 | "name": "nimbus"
8 | }
9 | },
10 | "spec": {
11 | "containers": [
12 | {
13 | "name": "nimbus",
14 | "image": "mattf/storm-nimbus",
15 | "ports": [
16 | {
17 | "containerPort": 6627
18 | }
19 | ],
20 | "resources": {
21 | "limits": {
22 | "cpu": "100m"
23 | }
24 | }
25 | }
26 | ]
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/staging/storm/storm-worker-controller.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: storm-worker-controller
5 | labels:
6 | name: storm-worker
7 | spec:
8 | replicas: 2
9 | selector:
10 | matchLabels:
11 | name: storm-worker
12 | uses: nimbus
13 | template:
14 | metadata:
15 | labels:
16 | name: storm-worker
17 | uses: nimbus
18 | spec:
19 | containers:
20 | - name: storm-worke
21 | image: mattf/storm-worker
22 | resources:
23 | limits:
24 | cpu: 200m
25 | memory: 500Mi
26 | requests:
27 | cpu: 100m
28 | memory: 100Mi
29 | ports:
30 | - hostPort: 6700
31 | containerPort: 6700
32 | - hostPort: 6701
33 | containerPort: 6701
34 | - hostPort: 6702
35 | containerPort: 6702
36 | - hostPort: 6703
37 | containerPort: 6703
38 |
--------------------------------------------------------------------------------
/staging/storm/zookeeper-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Service",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "zookeeper",
6 | "labels": {
7 | "name": "zookeeper"
8 | }
9 | },
10 | "spec": {
11 | "ports": [
12 | {
13 | "port": 2181
14 | }
15 | ],
16 | "selector": {
17 | "name": "zookeeper"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/staging/storm/zookeeper.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Pod",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "zookeeper",
6 | "labels": {
7 | "name": "zookeeper"
8 | }
9 | },
10 | "spec": {
11 | "containers": [
12 | {
13 | "name": "zookeeper",
14 | "image": "mattf/zookeeper",
15 | "ports": [
16 | {
17 | "containerPort": 2181
18 | }
19 | ],
20 | "resources": {
21 | "limits": {
22 | "cpu": "100m"
23 | }
24 | }
25 | }
26 | ]
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/staging/volumes/aws_ebs/README.md:
--------------------------------------------------------------------------------
1 | This is a simple web server pod which serves HTML from an AWS EBS
2 | volume.
3 |
4 | If you did not use kube-up script, make sure that your masters have the following IAM permissions ([Amazon IAM Roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#create-iam-role-console)):
5 |
6 | ```shell
7 | ec2:AttachVolume
8 | ec2:DetachVolume
9 | ec2:DescribeInstances
10 | ec2:DescribeVolumes
11 | ```
12 |
13 | Create a volume in the same region as your node.
14 |
15 | Add your volume information in the pod description file aws-ebs-web.yaml then create the pod:
16 |
17 | ```shell
18 | $ kubectl create -f examples/volumes/aws_ebs/aws-ebs-web.yaml
19 | ```
20 |
21 | Add some data to the volume if is empty:
22 |
23 | ```sh
24 | $ echo "Hello World" >& /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/aws/{Region}/{Volume ID}/index.html
25 | ```
26 |
27 | You should now be able to query your web server:
28 |
29 | ```sh
30 | $ curl
31 | $ Hello World
32 | ```
33 |
34 |
35 |
36 | []()
37 |
38 |
--------------------------------------------------------------------------------
/staging/volumes/aws_ebs/aws-ebs-web.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: aws-web
5 | spec:
6 | containers:
7 | - name: web
8 | image: nginx
9 | ports:
10 | - name: web
11 | containerPort: 80
12 | protocol: tcp
13 | volumeMounts:
14 | - name: html-volume
15 | mountPath: "/usr/share/nginx/html"
16 | volumes:
17 | - name: html-volume
18 | awsElasticBlockStore:
19 | # Enter the volume ID below
20 | volumeID: volume_ID
21 | fsType: ext4
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/README.md:
--------------------------------------------------------------------------------
1 | # How to Use it?
2 |
3 | On Azure VM, create a Pod using the volume spec based on [azure](azure.yaml).
4 |
5 | In the pod, you need to provide the following information:
6 |
7 | - *diskName*: (required) the name of the VHD blob object OR the name of an Azure managed data disk if Kind is Managed.
8 | - *diskURI*: (required) the URI of the vhd blob object OR the resourceID of an Azure managed data disk if Kind is Managed.
9 | - *kind*: (optional) kind of disk. Must be one of Shared (multiple disks per storage account), Dedicated (single blob disk per storage account), or Managed (Azure managed data disk). Default is Shared.
10 | - *cachingMode*: (optional) disk caching mode. Must be one of None, ReadOnly, or ReadWrite. Default is None.
11 | - *fsType*: (optional) the filesystem type to mount. Default is ext4.
12 | - *readOnly*: (optional) whether the filesystem is used as readOnly. Default is false.
13 |
14 |
15 | Launch the Pod:
16 |
17 | ```console
18 | # kubectl create -f examples/volumes/azure_disk/azure.yaml
19 | ```
20 |
21 |
22 | []()
23 |
24 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/azure.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: azure
5 | spec:
6 | containers:
7 | - image: kubernetes/pause
8 | name: azure
9 | volumeMounts:
10 | - name: azure
11 | mountPath: /mnt/azure
12 | volumes:
13 | - name: azure
14 | azureDisk:
15 | diskName: test.vhd
16 | diskURI: https://someaccount.blob.microsoft.net/vhds/test.vhd
17 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/account-specified-hdd/pod-uses-account-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-account-hdd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/blobdisk/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: blobdisk01
17 | mountPath: /mnt/blobdisk
18 | volumes:
19 | - name: blobdisk01
20 | persistentVolumeClaim:
21 | claimName: pv-dd-account-hdd-5g
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/account-specified-hdd/pvc-on-account-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pv-dd-account-hdd-5g
5 | annotations:
6 | volume.beta.kubernetes.io/storage-class: accounthdd
7 | spec:
8 | accessModes:
9 | - ReadWriteOnce
10 | resources:
11 | requests:
12 | storage: 5Gi
13 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/account-specified-hdd/storageclass-account-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1beta1
3 | metadata:
4 | name: accounthdd
5 | provisioner: kubernetes.io/azure-disk
6 | parameters:
7 | skuname: Standard_LRS
8 | location: westus
9 | storageAccount: azuretestx
10 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/dedicated-hdd/pod-uses-dedicated-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-dedicated-hdd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/blobdisk/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: blobdisk01
17 | mountPath: /mnt/blobdisk
18 | volumes:
19 | - name: blobdisk01
20 | persistentVolumeClaim:
21 | claimName: pv-dd-dedicated-hdd-5g
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/dedicated-hdd/pvc-on-dedicated-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pv-dd-dedicated-hdd-5g
5 | annotations:
6 | volume.beta.kubernetes.io/storage-class: dedicatedhdd
7 | spec:
8 | accessModes:
9 | - ReadWriteOnce
10 | resources:
11 | requests:
12 | storage: 5Gi
13 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/dedicated-hdd/storageclass-dedicated-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1beta1
3 | metadata:
4 | name: dedicatedhdd
5 | provisioner: kubernetes.io/azure-disk
6 | parameters:
7 | skuname: Standard_LRS
8 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/shared-hdd/pod-uses-shared-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-shared-hdd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/blobdisk/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: blobdisk01
17 | mountPath: /mnt/blobdisk
18 | volumes:
19 | - name: blobdisk01
20 | persistentVolumeClaim:
21 | claimName: pv-dd-shared-hdd-5g
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/shared-hdd/pvc-on-shared-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pv-dd-shared-hdd-5g
5 | annotations:
6 | volume.beta.kubernetes.io/storage-class: sharedhdd
7 | spec:
8 | accessModes:
9 | - ReadWriteOnce
10 | resources:
11 | requests:
12 | storage: 5Gi
13 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/shared-hdd/storageclass-shared-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1beta1
3 | metadata:
4 | name: sharedhdd
5 | provisioner: kubernetes.io/azure-disk
6 | parameters:
7 | skuname: Standard_LRS
8 | kind: Shared
9 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/shared-ssd/pod-uses-shared-ssd.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-shared-ssd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/blobdisk/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: blobdisk01
17 | mountPath: /mnt/blobdisk
18 | volumes:
19 | - name: blobdisk01
20 | persistentVolumeClaim:
21 | claimName: pv-dd-shared-ssd-5g
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/shared-ssd/pvc-on-shared-ssd.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pv-dd-shared-ssd-5g
5 | annotations:
6 | volume.beta.kubernetes.io/storage-class: sharedssd
7 | spec:
8 | accessModes:
9 | - ReadWriteOnce
10 | resources:
11 | requests:
12 | storage: 5Gi
13 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/blob-based-disk/shared-ssd/storageclass-shared-ssd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1beta1
3 | metadata:
4 | name: sharedssd
5 | provisioner: kubernetes.io/azure-disk
6 | parameters:
7 | skuname: Premium_LRS
8 | kind: Shared
9 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/managed-disk/managed-hdd/pod-uses-managed-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-managed-hdd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/managed/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: managed01
17 | mountPath: /mnt/managed
18 | volumes:
19 | - name: managed01
20 | persistentVolumeClaim:
21 | claimName: dd-managed-hdd-5g
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/managed-disk/managed-hdd/pvc-on-managed-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: dd-managed-hdd-5g
5 | annotations:
6 | volume.beta.kubernetes.io/storage-class: managedhdd
7 | spec:
8 | accessModes:
9 | - ReadWriteOnce
10 | resources:
11 | requests:
12 | storage: 5Gi
13 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/managed-disk/managed-hdd/storageclass-managed-hdd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1beta1
3 | metadata:
4 | name: managedhdd
5 | provisioner: kubernetes.io/azure-disk
6 | parameters:
7 | storageaccounttype: Standard_LRS
8 | kind: Managed
9 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/managed-disk/managed-ssd/pod-uses-managed-ssd.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-managed-ssd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/managed/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: managed01
17 | mountPath: /mnt/managed
18 | volumes:
19 | - name: managed01
20 | persistentVolumeClaim:
21 | claimName: dd-managed-ssd-5g
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/managed-disk/managed-ssd/pvc-on-managed-ssd.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: dd-managed-ssd-5g
5 | annotations:
6 | volume.beta.kubernetes.io/storage-class: managedssd
7 | spec:
8 | accessModes:
9 | - ReadWriteOnce
10 | resources:
11 | requests:
12 | storage: 5Gi
13 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/claim/managed-disk/managed-ssd/storageclass-managed-ssd.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1beta1
3 | metadata:
4 | name: managedssd
5 | provisioner: kubernetes.io/azure-disk
6 | parameters:
7 | storageaccounttype: Premium_LRS
8 | kind: Managed
9 |
--------------------------------------------------------------------------------
/staging/volumes/azure_disk/static-provisioning/managed-disk/pod-uses-existing-managed-disk.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-uses-managed-ssd-5g
5 | labels:
6 | name: storage
7 | spec:
8 | containers:
9 | - image: nginx
10 | name: az-c-01
11 | command:
12 | - /bin/sh
13 | - -c
14 | - while true; do echo $(date) >> /mnt/managed/outfile; sleep 1; done
15 | volumeMounts:
16 | - name: managed01
17 | mountPath: /mnt/managed
18 | volumes:
19 | - name: managed01
20 | azureDisk:
21 | kind: Managed
22 | diskName: myDisk
23 | diskURI: /subscriptions//resourceGroups//providers/Microsoft.Compute/disks/
24 |
25 |
--------------------------------------------------------------------------------
/staging/volumes/azure_file/azure-2.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: azure-2
5 | spec:
6 | containers:
7 | - image: kubernetes/pause
8 | name: azure-2
9 | volumeMounts:
10 | - name: azure
11 | mountPath: /mnt/azure
12 | volumes:
13 | - name: azure
14 | persistentVolumeClaim:
15 | claimName: sample-storage-claim
16 |
--------------------------------------------------------------------------------
/staging/volumes/azure_file/azure-pv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: sample-storage
5 | # The label is used for matching the exact claim
6 | labels:
7 | usage: sample-storage
8 | spec:
9 | capacity:
10 | storage: 10Gi
11 | accessModes:
12 | - ReadWriteMany
13 | persistentVolumeReclaimPolicy: Retain
14 | azureFile:
15 | # Replace with your secret name
16 | secretName: azure-secret
17 | # Replace with correct storage share name
18 | shareName: k8stest
19 | # In case the secret is stored in a different namespace
20 | #shareNamespace: default
21 | readOnly: false
22 |
--------------------------------------------------------------------------------
/staging/volumes/azure_file/azure-pvc.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: sample-storage-claim
5 | # Set this annotation to NOT let Kubernetes automatically create
6 | # a persistent volume for this volume claim.
7 | annotations:
8 | volume.beta.kubernetes.io/storage-class: ""
9 | spec:
10 | accessModes:
11 | - ReadWriteMany
12 | resources:
13 | requests:
14 | storage: 10Gi
15 | selector:
16 | # To make sure we match the claim with the exact volume, match the label
17 | matchLabels:
18 | usage: sample-storage
19 |
--------------------------------------------------------------------------------
/staging/volumes/azure_file/azure.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: azure
5 | spec:
6 | containers:
7 | - image: kubernetes/pause
8 | name: azure
9 | volumeMounts:
10 | - name: azure
11 | mountPath: /mnt/azure
12 | volumes:
13 | - name: azure
14 | azureFile:
15 | secretName: azure-secret
16 | shareName: k8stest
17 | readOnly: false
18 |
--------------------------------------------------------------------------------
/staging/volumes/azure_file/secret/azure-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: azure-secret
5 | type: Opaque
6 | data:
7 | azurestorageaccountname: azhzdGVzdA==
8 | azurestorageaccountkey: eElGMXpKYm5ub2pGTE1Ta0JwNTBteDAyckhzTUsyc2pVN21GdDRMMTNob0I3ZHJBYUo4akQ2K0E0NDNqSm9nVjd5MkZVT2hRQ1dQbU02WWFOSHk3cWc9PQ==
9 |
--------------------------------------------------------------------------------
/staging/volumes/cephfs/cephfs-with-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: cephfs2
5 | spec:
6 | containers:
7 | - name: cephfs-rw
8 | image: kubernetes/pause
9 | volumeMounts:
10 | - mountPath: "/mnt/cephfs"
11 | name: cephfs
12 | volumes:
13 | - name: cephfs
14 | cephfs:
15 | monitors:
16 | - 10.16.154.78:6789
17 | - 10.16.154.82:6789
18 | - 10.16.154.83:6789
19 | user: admin
20 | secretRef:
21 | name: ceph-secret
22 | readOnly: true
23 |
--------------------------------------------------------------------------------
/staging/volumes/cephfs/cephfs.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: cephfs
5 | spec:
6 | containers:
7 | - name: cephfs-rw
8 | image: kubernetes/pause
9 | volumeMounts:
10 | - mountPath: "/mnt/cephfs"
11 | name: cephfs
12 | volumes:
13 | - name: cephfs
14 | cephfs:
15 | monitors:
16 | - 10.16.154.78:6789
17 | - 10.16.154.82:6789
18 | - 10.16.154.83:6789
19 | # by default the path is /, but you can override and mount a specific path of the filesystem by using the path attribute
20 | # path: /some/path/in/side/cephfs
21 | user: admin
22 | secretFile: "/etc/ceph/admin.secret"
23 | readOnly: true
24 |
--------------------------------------------------------------------------------
/staging/volumes/cephfs/secret/ceph-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: ceph-secret
5 | data:
6 | key: QVFCMTZWMVZvRjVtRXhBQTVrQ1FzN2JCajhWVUxSdzI2Qzg0SEE9PQ==
7 |
--------------------------------------------------------------------------------
/staging/volumes/cinder/README.md:
--------------------------------------------------------------------------------
1 | This is a simple web server pod which serves HTML from an Cinder volume.
2 |
3 | Create a volume in the same tenant and zone as your node.
4 |
5 | Add your volume information in the pod description file cinder-web.yaml then create the pod:
6 |
7 | ```shell
8 | $ kubectl create -f examples/volumes/cinder/cinder-web.yaml
9 | ```
10 |
11 | Add some data to the volume if is empty:
12 |
13 | ```sh
14 | $ echo "Hello World" >& /var/lib/kubelet/plugins/kubernetes.io/cinder/mounts/{Volume ID}/index.html
15 | ```
16 |
17 | You should now be able to query your web server:
18 |
19 | ```sh
20 | $ curl
21 | $ Hello World
22 | ```
23 |
24 |
25 |
26 | []()
27 |
28 |
--------------------------------------------------------------------------------
/staging/volumes/cinder/cinder-web.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: cinder-web
5 | spec:
6 | containers:
7 | - name: web
8 | image: nginx
9 | ports:
10 | - name: web
11 | containerPort: 80
12 | protocol: tcp
13 | volumeMounts:
14 | - name: html-volume
15 | mountPath: "/usr/share/nginx/html"
16 | volumes:
17 | - name: html-volume
18 | cinder:
19 | # Enter the volume ID below
20 | volumeID: volume_ID
21 | fsType: ext4
22 |
--------------------------------------------------------------------------------
/staging/volumes/fibre_channel/fc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: fc
5 | spec:
6 | containers:
7 | - image: kubernetes/pause
8 | name: fc
9 | volumeMounts:
10 | - name: fc-vol
11 | mountPath: /mnt/fc
12 | volumes:
13 | - name: fc-vol
14 | fc:
15 | targetWWNs: ['500a0982991b8dc5', '500a0982891b8dc5']
16 | lun: 2
17 | fsType: ext4
18 | readOnly: true
19 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/README.md:
--------------------------------------------------------------------------------
1 | Please refer to https://github.com/kubernetes/community/tree/master/contributors/devel/flexvolume.md for documentation.
2 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/deploy/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2018 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM busybox
16 | WORKDIR .
17 |
18 | # TODO Change to your desired driver.
19 | COPY ./drivers/dummy /dummy
20 |
21 | COPY deploy.sh /deploy.sh
22 | CMD /bin/sh /deploy.sh
23 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/deploy/README.md:
--------------------------------------------------------------------------------
1 | This directory contains an example of the DaemonSet Flexvolume driver deployment method. See documentation [here](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/flexvolume-deployment.md#recommended-driver-deployment-method).
2 |
3 | Steps to use the DaemonSet deployment method:
4 | 1. Copy the Flexvolume driver to `drivers` directory. To get a basic example running, copy the `dummy` driver from the parent directory.
5 | 1. If you'd like to just get a basic example running, you could skip this step. Otherwise, change the places marked with `TODO` in all files.
6 | 1. Build the deployment Docker image and upload to your container registry.
7 | 1. Create the DaemonSet.
8 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/deploy/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Copyright 2018 The Kubernetes Authors.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | set -o errexit
18 | set -o pipefail
19 |
20 | # TODO change to your desired driver.
21 | VENDOR=${VENDOR:-k8s}
22 | DRIVER=${DRIVER:-dummy}
23 |
24 | # Assuming the single driver file is located at /$DRIVER inside the DaemonSet image.
25 |
26 | driver_dir=$VENDOR${VENDOR:+"~"}${DRIVER}
27 | if [ ! -d "/flexmnt/$driver_dir" ]; then
28 | mkdir "/flexmnt/$driver_dir"
29 | fi
30 |
31 | tmp_driver=.tmp_$DRIVER
32 | cp "/$DRIVER" "/flexmnt/$driver_dir/$tmp_driver"
33 | mv -f "/flexmnt/$driver_dir/$tmp_driver" "/flexmnt/$driver_dir/$DRIVER"
34 |
35 | while : ; do
36 | sleep 3600
37 | done
38 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/deploy/ds.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: DaemonSet
3 | metadata:
4 | name: flex-ds
5 | spec:
6 | template:
7 | metadata:
8 | name: flex-deploy
9 | labels:
10 | app: flex-deploy
11 | spec:
12 | containers:
13 | # TODO Change to your container registry.
14 | - image: ""
15 | name: flex-deploy
16 | securityContext:
17 | privileged: true
18 | volumeMounts:
19 | - mountPath: /flexmnt
20 | name: flexvolume-mount
21 | volumes:
22 | - name: flexvolume-mount
23 | hostPath:
24 | # TODO Change to the Flexvolume plugin directory of your cluster.
25 | path: /usr/libexec/kubernetes/kubelet-plugins/volume/exec/
26 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/nginx-dummy-attachable.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx-dummy-attachable
5 | namespace: default
6 | spec:
7 | containers:
8 | - name: nginx-dummy-attachable
9 | image: nginx
10 | volumeMounts:
11 | - name: dummy-attachable
12 | mountPath: /data
13 | ports:
14 | - containerPort: 80
15 | volumes:
16 | - name: dummy-attachable
17 | flexVolume:
18 | driver: "k8s/dummy-attachable"
19 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/nginx-dummy.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx-dummy
5 | namespace: default
6 | spec:
7 | containers:
8 | - name: nginx-dummy
9 | image: nginx
10 | volumeMounts:
11 | - name: dummy
12 | mountPath: /data
13 | ports:
14 | - containerPort: 80
15 | volumes:
16 | - name: dummy
17 | flexVolume:
18 | driver: "k8s/dummy"
19 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/nginx-lvm.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx
5 | namespace: default
6 | spec:
7 | containers:
8 | - name: nginx
9 | image: nginx
10 | volumeMounts:
11 | - name: test
12 | mountPath: /data
13 | ports:
14 | - containerPort: 80
15 | volumes:
16 | - name: test
17 | flexVolume:
18 | driver: "kubernetes.io/lvm"
19 | fsType: "ext4"
20 | options:
21 | volumeID: "vol1"
22 | size: "1000m"
23 | volumegroup: "kube_vg"
24 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/nginx-nfs.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx-nfs
5 | namespace: default
6 | spec:
7 | containers:
8 | - name: nginx-nfs
9 | image: nginx
10 | volumeMounts:
11 | - name: test
12 | mountPath: /data
13 | ports:
14 | - containerPort: 80
15 | volumes:
16 | - name: test
17 | flexVolume:
18 | driver: "k8s/nfs"
19 | fsType: "nfs"
20 | options:
21 | server: "172.16.0.25"
22 | share: "dws_nas_scratch"
23 |
--------------------------------------------------------------------------------
/staging/volumes/flexvolume/nginx.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: nginx
5 | namespace: default
6 | spec:
7 | containers:
8 | - name: nginx
9 | image: nginx
10 | volumeMounts:
11 | - name: test
12 | mountPath: /data
13 | ports:
14 | - containerPort: 80
15 | volumes:
16 | - name: test
17 | flexVolume:
18 | driver: "kubernetes.io/lvm"
19 | fsType: "ext4"
20 | options:
21 | volumeID: "vol1"
22 | size: "1000m"
23 | volumegroup: "kube_vg"
24 |
--------------------------------------------------------------------------------
/staging/volumes/flocker/flocker-pod-with-rc.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: flocker-ghost
5 | labels:
6 | app: flocker-ghost
7 | spec:
8 | ports:
9 | # the port that this service should serve on
10 | - port: 80
11 | targetPort: 80
12 | selector:
13 | app: flocker-ghost
14 | ---
15 | apiVersion: v1
16 | kind: ReplicationController
17 | metadata:
18 | name: flocker-ghost
19 | # these labels can be applied automatically
20 | # from the labels in the pod template if not set
21 | labels:
22 | purpose: demo
23 | spec:
24 | replicas: 1
25 | template:
26 | metadata:
27 | labels:
28 | app: flocker-ghost
29 | spec:
30 | containers:
31 | - name: flocker-ghost
32 | image: ghost:0.7.1
33 | env:
34 | - name: GET_HOSTS_FROM
35 | value: dns
36 | ports:
37 | - containerPort: 2368
38 | hostPort: 80
39 | protocol: TCP
40 | volumeMounts:
41 | # name must match the volume name below
42 | - name: ghost-data
43 | mountPath: "/var/lib/ghost"
44 | volumes:
45 | - name: ghost-data
46 | flocker:
47 | datasetName: my-flocker-vol
48 |
--------------------------------------------------------------------------------
/staging/volumes/flocker/flocker-pod.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: flocker-web
5 | spec:
6 | containers:
7 | - name: web
8 | image: nginx
9 | ports:
10 | - name: web
11 | containerPort: 80
12 | volumeMounts:
13 | # name must match the volume name below
14 | - name: www-root
15 | mountPath: "/usr/share/nginx/html"
16 | volumes:
17 | - name: www-root
18 | flocker:
19 | datasetName: my-flocker-vol
20 |
--------------------------------------------------------------------------------
/staging/volumes/glusterfs/glusterfs-endpoints.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Endpoints",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "glusterfs-cluster"
6 | },
7 | "subsets": [
8 | {
9 | "addresses": [
10 | {
11 | "ip": "10.240.106.152"
12 | }
13 | ],
14 | "ports": [
15 | {
16 | "port": 1
17 | }
18 | ]
19 | },
20 | {
21 | "addresses": [
22 | {
23 | "ip": "10.240.79.157"
24 | }
25 | ],
26 | "ports": [
27 | {
28 | "port": 1
29 | }
30 | ]
31 | }
32 | ]
33 | }
34 |
--------------------------------------------------------------------------------
/staging/volumes/glusterfs/glusterfs-pod.json:
--------------------------------------------------------------------------------
1 | {
2 | "apiVersion": "v1",
3 | "kind": "Pod",
4 | "metadata": {
5 | "name": "glusterfs"
6 | },
7 | "spec": {
8 | "containers": [
9 | {
10 | "name": "glusterfs",
11 | "image": "nginx",
12 | "volumeMounts": [
13 | {
14 | "mountPath": "/mnt/glusterfs",
15 | "name": "glusterfsvol"
16 | }
17 | ]
18 | }
19 | ],
20 | "volumes": [
21 | {
22 | "name": "glusterfsvol",
23 | "glusterfs": {
24 | "endpoints": "glusterfs-cluster",
25 | "path": "kube_vol",
26 | "readOnly": true
27 | }
28 | }
29 | ]
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/staging/volumes/glusterfs/glusterfs-service.json:
--------------------------------------------------------------------------------
1 | {
2 | "kind": "Service",
3 | "apiVersion": "v1",
4 | "metadata": {
5 | "name": "glusterfs-cluster"
6 | },
7 | "spec": {
8 | "ports": [
9 | {"port": 1}
10 | ]
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/staging/volumes/iscsi/chap-secret.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Secret
4 | metadata:
5 | name: chap-secret
6 | type: "kubernetes.io/iscsi-chap"
7 | data:
8 | discovery.sendtargets.auth.username: dXNlcg==
9 | discovery.sendtargets.auth.password: ZGVtbw==
10 | discovery.sendtargets.auth.username_in: bXVzZXI=
11 | discovery.sendtargets.auth.password_in: bXBhc3M=
12 | node.session.auth.username: dXNlcm5hbWU=
13 | node.session.auth.password: cGFzc3dvcmQ=
14 | node.session.auth.username_in: bXVzZXIy
15 | node.session.auth.password_in: bXBhc3My
16 |
--------------------------------------------------------------------------------
/staging/volumes/iscsi/iscsi-chap.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Pod
4 | metadata:
5 | name: iscsipd
6 | spec:
7 | containers:
8 | - name: iscsipd-ro
9 | image: kubernetes/pause
10 | volumeMounts:
11 | - mountPath: "/mnt/iscsipd"
12 | name: iscsivol
13 | volumes:
14 | - name: iscsivol
15 | iscsi:
16 | targetPortal: 127.0.0.1
17 | iqn: iqn.2015-02.example.com:test
18 | lun: 0
19 | fsType: ext4
20 | readOnly: true
21 | chapAuthDiscovery: true
22 | chapAuthSession: true
23 | secretRef:
24 | name: chap-secret
25 |
--------------------------------------------------------------------------------
/staging/volumes/iscsi/iscsi.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Pod
4 | metadata:
5 | name: iscsipd
6 | spec:
7 | containers:
8 | - name: iscsipd-rw
9 | image: kubernetes/pause
10 | volumeMounts:
11 | - mountPath: "/mnt/iscsipd"
12 | name: iscsipd-rw
13 | volumes:
14 | - name: iscsipd-rw
15 | iscsi:
16 | targetPortal: 10.0.2.15:3260
17 | portals: ['10.0.2.16:3260', '10.0.2.17:3260']
18 | iqn: iqn.2001-04.com.example:storage.kube.sys1.xyz
19 | lun: 0
20 | fsType: ext4
21 | readOnly: true
22 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-busybox-rc.yaml:
--------------------------------------------------------------------------------
1 | # This mounts the nfs volume claim into /mnt and continuously
2 | # overwrites /mnt/index.html with the time and hostname of the pod.
3 |
4 | apiVersion: v1
5 | kind: ReplicationController
6 | metadata:
7 | name: nfs-busybox
8 | spec:
9 | replicas: 2
10 | selector:
11 | name: nfs-busybox
12 | template:
13 | metadata:
14 | labels:
15 | name: nfs-busybox
16 | spec:
17 | containers:
18 | - image: busybox
19 | command:
20 | - sh
21 | - -c
22 | - 'while true; do date > /mnt/index.html; hostname >> /mnt/index.html; sleep $(($RANDOM % 5 + 5)); done'
23 | imagePullPolicy: IfNotPresent
24 | name: busybox
25 | volumeMounts:
26 | # name must match the volume name below
27 | - name: nfs
28 | mountPath: "/mnt"
29 | volumes:
30 | - name: nfs
31 | persistentVolumeClaim:
32 | claimName: nfs
33 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-data/Dockerfile:
--------------------------------------------------------------------------------
1 | # Copyright 2016 The Kubernetes Authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | FROM centos
16 | RUN yum -y install /usr/bin/ps nfs-utils && yum clean all
17 | RUN mkdir -p /exports
18 | ADD run_nfs.sh /usr/local/bin/
19 | ADD index.html /tmp/index.html
20 | RUN chmod 644 /tmp/index.html
21 |
22 | # expose mountd 20048/tcp and nfsd 2049/tcp and rpcbind 111/tcp
23 | EXPOSE 2049/tcp 20048/tcp 111/tcp 111/udp
24 |
25 | ENTRYPOINT ["/usr/local/bin/run_nfs.sh", "/exports"]
26 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-data/README.md:
--------------------------------------------------------------------------------
1 | # NFS-exporter container with a file
2 |
3 | This container exports /exports with index.html in it via NFS. Based on
4 | ../exports. Since some Linux kernels have issues running NFSv4 daemons in containers,
5 | only NFSv3 is opened in this container.
6 |
7 | Available as `gcr.io/google-samples/nfs-server`
8 |
9 |
10 |
11 |
12 | []()
13 |
14 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-data/index.html:
--------------------------------------------------------------------------------
1 | Hello world!
2 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-pv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nigelpoulton/k8s-sample-apps/90145b4f11aa6a40a7e376894430438b868dde2d/staging/volumes/nfs/nfs-pv.png
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-pv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: nfs
5 | spec:
6 | capacity:
7 | storage: 1Mi
8 | accessModes:
9 | - ReadWriteMany
10 | nfs:
11 | # FIXME: use the right IP
12 | server: 10.244.1.4
13 | path: "/"
14 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-pvc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | name: nfs
5 | spec:
6 | accessModes:
7 | - ReadWriteMany
8 | storageClassName: ""
9 | resources:
10 | requests:
11 | storage: 1Mi
12 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-server-rc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ReplicationController
3 | metadata:
4 | name: nfs-server
5 | spec:
6 | replicas: 1
7 | selector:
8 | role: nfs-server
9 | template:
10 | metadata:
11 | labels:
12 | role: nfs-server
13 | spec:
14 | containers:
15 | - name: nfs-server
16 | image: k8s.gcr.io/volume-nfs:0.8
17 | ports:
18 | - name: nfs
19 | containerPort: 2049
20 | - name: mountd
21 | containerPort: 20048
22 | - name: rpcbind
23 | containerPort: 111
24 | securityContext:
25 | privileged: true
26 | volumeMounts:
27 | - mountPath: /exports
28 | name: mypvc
29 | volumes:
30 | - name: mypvc
31 | persistentVolumeClaim:
32 | claimName: nfs-pv-provisioning-demo
33 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-server-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: nfs-server
5 | spec:
6 | ports:
7 | - name: nfs
8 | port: 2049
9 | - name: mountd
10 | port: 20048
11 | - name: rpcbind
12 | port: 111
13 | selector:
14 | role: nfs-server
15 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-web-rc.yaml:
--------------------------------------------------------------------------------
1 | # This pod mounts the nfs volume claim into /usr/share/nginx/html and
2 | # serves a simple web page.
3 |
4 | apiVersion: v1
5 | kind: ReplicationController
6 | metadata:
7 | name: nfs-web
8 | spec:
9 | replicas: 2
10 | selector:
11 | role: web-frontend
12 | template:
13 | metadata:
14 | labels:
15 | role: web-frontend
16 | spec:
17 | containers:
18 | - name: web
19 | image: nginx
20 | ports:
21 | - name: web
22 | containerPort: 80
23 | volumeMounts:
24 | # name must match the volume name below
25 | - name: nfs
26 | mountPath: "/usr/share/nginx/html"
27 | volumes:
28 | - name: nfs
29 | persistentVolumeClaim:
30 | claimName: nfs
31 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/nfs-web-service.yaml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: nfs-web
5 | spec:
6 | ports:
7 | - port: 80
8 | selector:
9 | role: web-frontend
10 |
--------------------------------------------------------------------------------
/staging/volumes/nfs/provisioner/nfs-server-gce-pv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | name: nfs-pv-provisioning-demo
5 | labels:
6 | demo: nfs-pv-provisioning
7 | spec:
8 | accessModes: [ "ReadWriteOnce" ]
9 | resources:
10 | requests:
11 | storage: 200Gi
12 |
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: test-portworx-volume-pod
5 | spec:
6 | containers:
7 | - image: k8s.gcr.io/test-webserver
8 | name: test-container
9 | volumeMounts:
10 | - mountPath: /test-portworx-volume
11 | name: test-volume
12 | volumes:
13 | - name: test-volume
14 | # This Portworx volume must already exist.
15 | portworxVolume:
16 | volumeID: "vol1"
17 |
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-pv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: pv0001
5 | spec:
6 | capacity:
7 | storage: 2Gi
8 | accessModes:
9 | - ReadWriteOnce
10 | persistentVolumeReclaimPolicy: Retain
11 | portworxVolume:
12 | volumeID: "pv0001"
13 |
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-pvc.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pvc0001
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 2Gi
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-pvcpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: pvpod
5 | spec:
6 | containers:
7 | - name: test-container
8 | image: k8s.gcr.io/test-webserver
9 | volumeMounts:
10 | - name: test-volume
11 | mountPath: /test-portworx-volume
12 | volumes:
13 | - name: test-volume
14 | persistentVolumeClaim:
15 | claimName: pvc0001
16 |
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-pvcsc.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pvcsc001
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 2Gi
11 | storageClassName: portworx-io-priority-high
12 |
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-pvcscpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: pvpod
5 | spec:
6 | containers:
7 | - name: test-container
8 | image: k8s.gcr.io/test-webserver
9 | volumeMounts:
10 | - name: test-volume
11 | mountPath: /test-portworx-volume
12 | volumes:
13 | - name: test-volume
14 | persistentVolumeClaim:
15 | claimName: pvcsc001
16 |
--------------------------------------------------------------------------------
/staging/volumes/portworx/portworx-volume-sc-high.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: portworx-io-priority-high
5 | provisioner: kubernetes.io/portworx-volume
6 | parameters:
7 | repl: "1"
8 | snap_interval: "70"
9 | io_priority: "high"
10 |
--------------------------------------------------------------------------------
/staging/volumes/quobyte/quobyte-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: quobyte
5 | spec:
6 | containers:
7 | - name: quobyte
8 | image: kubernetes/pause
9 | volumeMounts:
10 | - mountPath: /mnt
11 | name: quobytevolume
12 | volumes:
13 | - name: quobytevolume
14 | quobyte:
15 | registry: registry:7861
16 | volume: testVolume
17 | readOnly: false
18 | user: root
19 | group: root
20 |
--------------------------------------------------------------------------------
/staging/volumes/rbd/rbd-with-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: rbd2
5 | spec:
6 | containers:
7 | - image: kubernetes/pause
8 | name: rbd-rw
9 | volumeMounts:
10 | - name: rbdpd
11 | mountPath: /mnt/rbd
12 | volumes:
13 | - name: rbdpd
14 | rbd:
15 | monitors:
16 | - '10.16.154.78:6789'
17 | - '10.16.154.82:6789'
18 | - '10.16.154.83:6789'
19 | pool: kube
20 | image: foo
21 | fsType: ext4
22 | readOnly: true
23 | user: admin
24 | secretRef:
25 | name: ceph-secret
26 |
--------------------------------------------------------------------------------
/staging/volumes/rbd/rbd.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: rbd
5 | spec:
6 | containers:
7 | - image: kubernetes/pause
8 | name: rbd-rw
9 | volumeMounts:
10 | - name: rbdpd
11 | mountPath: /mnt/rbd
12 | volumes:
13 | - name: rbdpd
14 | rbd:
15 | monitors:
16 | - '10.16.154.78:6789'
17 | - '10.16.154.82:6789'
18 | - '10.16.154.83:6789'
19 | pool: kube
20 | image: foo
21 | fsType: ext4
22 | readOnly: true
23 | user: admin
24 | keyring: /etc/ceph/keyring
25 | imageformat: "2"
26 | imagefeatures: "layering"
27 |
28 |
--------------------------------------------------------------------------------
/staging/volumes/rbd/secret/ceph-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: ceph-secret
5 | type: "kubernetes.io/rbd"
6 | data:
7 | key: QVFCMTZWMVZvRjVtRXhBQTVrQ1FzN2JCajhWVUxSdzI2Qzg0SEE9PQ==
8 |
--------------------------------------------------------------------------------
/staging/volumes/scaleio/pod-sc-pvc.yaml:
--------------------------------------------------------------------------------
1 | kind: Pod
2 | apiVersion: v1
3 | metadata:
4 | name: pod-sio-small
5 | spec:
6 | containers:
7 | - name: pod-sio-small-container
8 | image: k8s.gcr.io/test-webserver
9 | volumeMounts:
10 | - mountPath: /test
11 | name: test-data
12 | volumes:
13 | - name: test-data
14 | persistentVolumeClaim:
15 | claimName: pvc-sio-small
16 |
--------------------------------------------------------------------------------
/staging/volumes/scaleio/pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: pod-0
5 | spec:
6 | containers:
7 | - image: k8s.gcr.io/test-webserver
8 | name: pod-0
9 | volumeMounts:
10 | - mountPath: /test-pd
11 | name: vol-0
12 | volumes:
13 | - name: vol-0
14 | scaleIO:
15 | gateway: https://localhost:443/api
16 | system: scaleio
17 | protectionDoamin: pd01
18 | storagePool: sp01
19 | volumeName: vol-0
20 | secretRef:
21 | name: sio-secret
22 | fsType: xfs
23 |
--------------------------------------------------------------------------------
/staging/volumes/scaleio/sc-pvc.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pvc-sio-small
5 | spec:
6 | storageClassName: sio-small
7 | accessModes:
8 | - ReadWriteOnce
9 | resources:
10 | requests:
11 | storage: 10Gi
12 | storageClassName: sio-small
13 |
--------------------------------------------------------------------------------
/staging/volumes/scaleio/sc.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: sio-small
5 | provisioner: kubernetes.io/scaleio
6 | parameters:
7 | gateway: https://localhost:443/api
8 | system: scaleio
9 | protectionDomain: pd01
10 | storagePool: pd01
11 | secretRef: sio-secret
12 | fsType: xfs
13 |
--------------------------------------------------------------------------------
/staging/volumes/scaleio/secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: sio-secret
5 | type: kubernetes.io/scaleio
6 | data:
7 | username: YWRtaW4=
8 | password: c0NhbGVpbzEyMw==
9 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | labels:
5 | name: redis
6 | role: master
7 | name: test-storageos-redis
8 | spec:
9 | containers:
10 | - name: master
11 | image: kubernetes/redis:v1
12 | env:
13 | - name: MASTER
14 | value: "true"
15 | ports:
16 | - containerPort: 6379
17 | resources:
18 | limits:
19 | cpu: "0.1"
20 | volumeMounts:
21 | - mountPath: /redis-master-data
22 | name: redis-data
23 | volumes:
24 | - name: redis-data
25 | storageos:
26 | # This volume must already exist within StorageOS
27 | volumeName: redis-vol01
28 | # Namespace is optional, and specifies the volume scope within
29 | # StorageOS. If no namespace is provided, it will use the namespace
30 | # of the pod. Set to `default` or leave blank if you are not using
31 | # namespaces.
32 | #namespace: test-storageos
33 | # The name of the storageos pool to use. Will use `default` if not
34 | # specified, which should be available on most StorageOS clusters.
35 | pool: default
36 | # The filesystem type to create on the volume, if required.
37 | fsType: ext4
38 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-pv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: pv0001
5 | spec:
6 | capacity:
7 | storage: 5Gi
8 | accessModes:
9 | - ReadWriteOnce
10 | persistentVolumeReclaimPolicy: Delete
11 | storageClassName: fast
12 | storageos:
13 | # This volume must already exist within StorageOS
14 | volumeName: pv0001
15 | # volumeNamespace is optional, and specifies the volume scope within
16 | # StorageOS. Set to `default` or leave blank if you are not using
17 | # namespaces.
18 | #volumeNamespace: default
19 | # The filesystem type to create on the volume, if required.
20 | fsType: ext4
21 | # The secret name for API credentials
22 | secretName: storageos-secret
23 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-pvc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | name: pvc0001
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 5Gi
11 | storageClassName: fast
12 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-pvcpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | labels:
5 | name: redis
6 | role: master
7 | name: test-storageos-redis-pvc
8 | spec:
9 | containers:
10 | - name: master
11 | image: kubernetes/redis:v1
12 | env:
13 | - name: MASTER
14 | value: "true"
15 | ports:
16 | - containerPort: 6379
17 | resources:
18 | limits:
19 | cpu: "0.1"
20 | volumeMounts:
21 | - mountPath: /redis-master-data
22 | name: redis-data
23 | volumes:
24 | - name: redis-data
25 | persistentVolumeClaim:
26 | claimName: pvc0001
27 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-sc-pvc.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolumeClaim
3 | metadata:
4 | name: fast0001
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | storageClassName: fast
9 | resources:
10 | requests:
11 | storage: 5Gi
12 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-sc-pvcpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | labels:
5 | name: redis
6 | role: master
7 | name: test-storageos-redis-sc-pvc
8 | spec:
9 | containers:
10 | - name: master
11 | image: kubernetes/redis:v1
12 | env:
13 | - name: MASTER
14 | value: "true"
15 | ports:
16 | - containerPort: 6379
17 | resources:
18 | limits:
19 | cpu: "0.1"
20 | volumeMounts:
21 | - mountPath: /redis-master-data
22 | name: redis-data
23 | volumes:
24 | - name: redis-data
25 | persistentVolumeClaim:
26 | claimName: fast0001
27 |
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-sc.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: sc-fast
5 | provisioner: kubernetes.io/storageos
6 | parameters:
7 | pool: default
8 | description: Kubernetes volume
9 | fsType: ext4
10 | adminSecretNamespace: default
11 | adminSecretName: storageos-secret
--------------------------------------------------------------------------------
/staging/volumes/storageos/storageos-secret.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: storageos-secret
5 | type: "kubernetes.io/storageos"
6 | data:
7 | apiAddress: dGNwOi8vMTI3LjAuMC4xOjU3MDU=
8 | apiUsername: c3RvcmFnZW9z
9 | apiPassword: c3RvcmFnZW9z
10 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: deployment
5 | spec:
6 | selector:
7 | matchLabels:
8 | app: redis
9 | replicas: 1
10 | template:
11 | metadata:
12 | labels:
13 | app: redis
14 | spec:
15 | containers:
16 | - name: redis
17 | image: redis
18 | volumeMounts:
19 | - name: vmfs-vmdk-storage
20 | mountPath: /data/
21 | volumes:
22 | - name: vmfs-vmdk-storage
23 | vsphereVolume:
24 | volumePath: "[Datastore] volumes/testdir"
25 | fsType: ext4
--------------------------------------------------------------------------------
/staging/volumes/vsphere/simple-statefulset.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | name: nginx
6 | labels:
7 | app: nginx
8 | spec:
9 | ports:
10 | - port: 80
11 | name: web
12 | clusterIP: None
13 | selector:
14 | app: nginx
15 | ---
16 | apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
17 | kind: StatefulSet
18 | metadata:
19 | name: web
20 | labels:
21 | app: nginx
22 | spec:
23 | serviceName: "nginx"
24 | selector:
25 | matchLabels:
26 | app: nginx
27 | replicas: 14
28 | template:
29 | metadata:
30 | labels:
31 | app: nginx
32 | spec:
33 | containers:
34 | - name: nginx
35 | image: k8s.gcr.io/nginx-slim:0.8
36 | ports:
37 | - containerPort: 80
38 | name: web
39 | volumeMounts:
40 | - name: www
41 | mountPath: /usr/share/nginx/html
42 | volumeClaimTemplates:
43 | - metadata:
44 | name: www
45 | spec:
46 | accessModes: [ "ReadWriteOnce" ]
47 | resources:
48 | requests:
49 | storage: 1Gi
50 | storageClassName: thin-disk
51 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/simple-storageclass.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: thin-disk
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: thin
8 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: test-vmdk
5 | spec:
6 | containers:
7 | - image: k8s.gcr.io/test-webserver
8 | name: test-container
9 | volumeMounts:
10 | - mountPath: /test-vmdk
11 | name: test-volume
12 | volumes:
13 | - name: test-volume
14 | # This VMDK volume must already exist.
15 | vsphereVolume:
16 | volumePath: "[DatastoreName] volumes/myDisk"
17 | fsType: ext4
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pv.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: PersistentVolume
3 | metadata:
4 | name: pv0001
5 | spec:
6 | capacity:
7 | storage: 2Gi
8 | accessModes:
9 | - ReadWriteOnce
10 | persistentVolumeReclaimPolicy: Retain
11 | vsphereVolume:
12 | volumePath: "[DatastoreName] volumes/myDisk"
13 | fsType: ext4
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pvc.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pvc0001
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 2Gi
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pvcpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: pvpod
5 | spec:
6 | containers:
7 | - name: test-container
8 | image: k8s.gcr.io/test-webserver
9 | volumeMounts:
10 | - name: test-volume
11 | mountPath: /test-vmdk
12 | volumes:
13 | - name: test-volume
14 | persistentVolumeClaim:
15 | claimName: pvc0001
16 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pvcsc.yaml:
--------------------------------------------------------------------------------
1 | kind: PersistentVolumeClaim
2 | apiVersion: v1
3 | metadata:
4 | name: pvcsc001
5 | spec:
6 | accessModes:
7 | - ReadWriteOnce
8 | resources:
9 | requests:
10 | storage: 2Gi
11 | storageClassName: fast
12 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pvcscpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: pvpod
5 | spec:
6 | containers:
7 | - name: test-container
8 | image: k8s.gcr.io/test-webserver
9 | volumeMounts:
10 | - name: test-volume
11 | mountPath: /test-vmdk
12 | volumes:
13 | - name: test-volume
14 | persistentVolumeClaim:
15 | claimName: pvcsc001
16 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-pvcscvsanpod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: pvpod
5 | spec:
6 | containers:
7 | - name: test-container
8 | image: k8s.gcr.io/test-webserver
9 | volumeMounts:
10 | - name: test-volume
11 | mountPath: /test
12 | volumes:
13 | - name: test-volume
14 | persistentVolumeClaim:
15 | claimName: pvcsc-vsan
16 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-sc-fast.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: fast
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: zeroedthick
8 | fstype: ext3
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-sc-vsancapabilities-with-datastore.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: fast
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: zeroedthick
8 | datastore: vsanDatastore
9 | hostFailuresToTolerate: "2"
10 | cachereservation: "20"
11 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-sc-vsancapabilities.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: fast
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: zeroedthick
8 | hostFailuresToTolerate: "2"
9 | cachereservation: "20"
10 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-sc-with-datastore.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: fast
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: zeroedthick
8 | datastore: vsanDatastore
9 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-spbm-policy-with-datastore.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: fast
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: zeroedthick
8 | storagePolicyName: gold
9 | datastore: VSANDatastore
10 |
--------------------------------------------------------------------------------
/staging/volumes/vsphere/vsphere-volume-spbm-policy.yaml:
--------------------------------------------------------------------------------
1 | kind: StorageClass
2 | apiVersion: storage.k8s.io/v1
3 | metadata:
4 | name: fast
5 | provisioner: kubernetes.io/vsphere-volume
6 | parameters:
7 | diskformat: zeroedthick
8 | storagePolicyName: gold
9 |
--------------------------------------------------------------------------------