diff --git a/13-1-dns-service.yaml b/13-1-dns-service.yaml deleted file mode 100644 index 23a7cd0..0000000 --- a/13-1-dns-service.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Service -apiVersion: v1 -metadata: - name: external-database -spec: - type: ExternalName - externalName: database.company.com diff --git a/13-1-my-config.txt b/13-1-my-config.txt new file mode 100644 index 0000000..5398066 --- /dev/null +++ b/13-1-my-config.txt @@ -0,0 +1,3 @@ +# This is a sample config file that I might use to configure an application +parameter1 = value1 +parameter2 = value2 diff --git a/13-10-mongo-simple.yaml b/13-10-mongo-simple.yaml deleted file mode 100644 index 9ef719f..0000000 --- a/13-10-mongo-simple.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: mongo -spec: - serviceName: "mongo" - replicas: 3 - selector: - matchLabels: - app: mongo - template: - metadata: - labels: - app: mongo - spec: - containers: - - name: mongodb - image: mongo:3.4.24 - command: - - mongod - - --replSet - - rs0 - ports: - - containerPort: 27017 - name: peer diff --git a/13-11-mongo-service.yaml b/13-11-mongo-service.yaml deleted file mode 100644 index 25a2cf4..0000000 --- a/13-11-mongo-service.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: mongo -spec: - ports: - - port: 27017 - name: peer - clusterIP: None - selector: - app: mongo diff --git a/13-12-mongo-configmap.yaml b/13-12-mongo-configmap.yaml deleted file mode 100644 index caa80bf..0000000 --- a/13-12-mongo-configmap.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: mongo-init -data: - init.sh: | - #!/bin/bash - - # Need to wait for the readiness health check to pass so that the - # mongo names resolve. This is kind of wonky. - until ping -c 1 ${HOSTNAME}.mongo; do - echo "waiting for DNS (${HOSTNAME}.mongo)..." - sleep 2 - done - - until /usr/bin/mongo --eval 'printjson(db.serverStatus())'; do - echo "connecting to local mongo..." - sleep 2 - done - echo "connected to local." - - HOST=mongo-0.mongo:27017 - - until /usr/bin/mongo --host=${HOST} --eval 'printjson(db.serverStatus())'; do - echo "connecting to remote mongo..." - sleep 2 - done - echo "connected to remote." - - if [[ "${HOSTNAME}" != 'mongo-0' ]]; then - until /usr/bin/mongo --host=${HOST} --eval="printjson(rs.status())" \ - | grep -v "no replset config has been received"; do - echo "waiting for replication set initialization" - sleep 2 - done - echo "adding self to mongo-0" - /usr/bin/mongo --host=${HOST} \ - --eval="printjson(rs.add('${HOSTNAME}.mongo'))" - fi - - if [[ "${HOSTNAME}" == 'mongo-0' ]]; then - echo "initializing replica set" - /usr/bin/mongo --eval="printjson(rs.initiate(\ - {'_id': 'rs0', 'members': [{'_id': 0, \ - 'host': 'mongo-0.mongo:27017'}]}))" - fi - echo "initialized" - - while true; do - sleep 3600 - done diff --git a/13-13-mongo.yaml b/13-13-mongo.yaml deleted file mode 100644 index 75f21ed..0000000 --- a/13-13-mongo.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: mongo -spec: - serviceName: "mongo" - replicas: 3 - selector: - matchLabels: - app: mongo - template: - metadata: - labels: - app: mongo - spec: - containers: - - name: mongodb - image: mongo:3.4.1 - command: - - mongod - - --replSet - - rs0 - ports: - - containerPort: 27017 - name: web - - name: init-mongo - image: mongo:3.4.1 - command: - - bash - - /config/init.sh - volumeMounts: - - name: config - mountPath: /config - volumes: - - name: config - configMap: - name: "mongo-init" diff --git a/13-2-external-ip-service.yaml b/13-2-external-ip-service.yaml deleted file mode 100644 index eef45ee..0000000 --- a/13-2-external-ip-service.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Service -apiVersion: v1 -metadata: - name: external-ip-database -spec: - ports: - - port: 3306 diff --git a/13-2-kuard-config.yaml b/13-2-kuard-config.yaml new file mode 100644 index 0000000..5edb44b --- /dev/null +++ b/13-2-kuard-config.yaml @@ -0,0 +1,35 @@ +apiVersion: v1 +kind: Pod +metadata: + name: kuard-config +spec: + containers: + - name: test-container + image: gcr.io/kuar-demo/kuard-amd64:blue + imagePullPolicy: Always + command: + - "/kuard" + - "$(EXTRA_PARAM)" + env: + # An example of an environment variable used inside the container + - name: ANOTHER_PARAM + valueFrom: + configMapKeyRef: + name: my-config + key: another-param + # An example of an environment variable passed to the command to start + # the container (above). + - name: EXTRA_PARAM + valueFrom: + configMapKeyRef: + name: my-config + key: extra-param + volumeMounts: + # Mounting the ConfigMap as a set of files + - name: config-volume + mountPath: /config + volumes: + - name: config-volume + configMap: + name: my-config + restartPolicy: Never diff --git a/13-3-external-ip-endpoints.yaml b/13-3-external-ip-endpoints.yaml deleted file mode 100644 index 208f732..0000000 --- a/13-3-external-ip-endpoints.yaml +++ /dev/null @@ -1,9 +0,0 @@ -kind: Endpoints -apiVersion: v1 -metadata: - name: external-ip-database -subsets: - - addresses: - - ip: 192.168.0.1 - ports: - - port: 3306 diff --git a/13-3-kuard-secret.yaml b/13-3-kuard-secret.yaml new file mode 100644 index 0000000..bf064d6 --- /dev/null +++ b/13-3-kuard-secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Pod +metadata: + name: kuard-tls +spec: + containers: + - name: kuard-tls + image: gcr.io/kuar-demo/kuard-amd64:blue + imagePullPolicy: Always + volumeMounts: + - name: tls-certs + mountPath: "/tls" + readOnly: true + volumes: + - name: tls-certs + secret: + secretName: kuard-tls diff --git a/13-4-kuard-secret-ips.yaml b/13-4-kuard-secret-ips.yaml new file mode 100644 index 0000000..ed1aff2 --- /dev/null +++ b/13-4-kuard-secret-ips.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: kuard-tls +spec: + containers: + - name: kuard-tls + image: gcr.io/kuar-demo/kuard-amd64:blue + imagePullPolicy: Always + volumeMounts: + - name: tls-certs + mountPath: "/tls" + readOnly: true + imagePullSecrets: + - name: my-image-pull-secret + volumes: + - name: tls-certs + secret: + secretName: kuard-tls diff --git a/13-4-nfs-volume.yaml b/13-4-nfs-volume.yaml deleted file mode 100644 index f3ff6cb..0000000 --- a/13-4-nfs-volume.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: database - labels: - volume: my-volume -spec: - accessModes: - - ReadWriteMany - capacity: - storage: 1Gi - nfs: - server: 192.168.0.1 - path: "/exports" diff --git a/13-5-nfs-volume-claim.yaml b/13-5-nfs-volume-claim.yaml deleted file mode 100644 index 05e76af..0000000 --- a/13-5-nfs-volume-claim.yaml +++ /dev/null @@ -1,13 +0,0 @@ -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: database -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 1Gi - selector: - matchLabels: - volume: my-volume diff --git a/13-6-mysql-replicaset.yaml b/13-6-mysql-replicaset.yaml deleted file mode 100644 index 041ef76..0000000 --- a/13-6-mysql-replicaset.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: apps/v1 -kind: ReplicaSet -metadata: - name: mysql - # labels so that we can bind a Service to this Pod - labels: - app: mysql -spec: - replicas: 1 - selector: - matchLabels: - app: mysql - template: - metadata: - labels: - app: mysql - spec: - containers: - - name: database - image: mysql - resources: - requests: - cpu: 1 - memory: 2Gi - env: - # Environment variables are not a best practice for security, - # but we're using them here for brevity in the example. - # See Chapter 11 for better options. - - name: MYSQL_ROOT_PASSWORD - value: some-password-here - livenessProbe: - tcpSocket: - port: 3306 - ports: - - containerPort: 3306 - volumeMounts: - - name: database - # /var/lib/mysql is where MySQL stores its databases - mountPath: "/var/lib/mysql" - volumes: - - name: database - persistentVolumeClaim: - claimName: database diff --git a/13-7-mysql-service.yaml b/13-7-mysql-service.yaml deleted file mode 100644 index 521cde2..0000000 --- a/13-7-mysql-service.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: mysql -spec: - ports: - - port: 3306 - protocol: TCP - selector: - app: mysql diff --git a/13-8-storageclass.yaml b/13-8-storageclass.yaml deleted file mode 100644 index 09c93fd..0000000 --- a/13-8-storageclass.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: default - annotations: - storageclass.beta.kubernetes.io/is-default-class: "true" - labels: - kubernetes.io/cluster-service: "true" -provisioner: kubernetes.io/azure-disk diff --git a/13-9-dynamic-volume-claim.yaml b/13-9-dynamic-volume-claim.yaml deleted file mode 100644 index ab1637c..0000000 --- a/13-9-dynamic-volume-claim.yaml +++ /dev/null @@ -1,12 +0,0 @@ -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: my-claim - annotations: - volume.beta.kubernetes.io/storage-class: default -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi diff --git a/14-1-parse.yaml b/14-1-parse.yaml deleted file mode 100644 index ceec9c1..0000000 --- a/14-1-parse.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: parse-server -spec: - replicas: 1 - selector: - matchLabels: - run: parse-server - template: - metadata: - labels: - run: parse-server - spec: - containers: - - name: parse-server - image: ${DOCKER_USER}/parse-server - env: - - name: PARSE_SERVER_DATABASE_URI - value: "mongodb://mongo-0.mongo:27017,\ - mongo-1.mongo:27017,mongo-2.mongo\ - :27017/dev?replicaSet=rs0" - - name: PARSE_SERVER_APP_ID - value: "my-app-id" - - name: PARSE_SERVER_MASTER_KEY - value: "my-master-key" diff --git a/14-10-redis.yaml b/14-10-redis.yaml deleted file mode 100644 index 1a17b3e..0000000 --- a/14-10-redis.yaml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: redis -spec: - replicas: 3 - serviceName: redis - selector: - matchLabels: - app: redis - template: - metadata: - labels: - app: redis - spec: - containers: - - command: [sh, -c, source /redis-config/init.sh ] - image: redis:3.2.7-alpine - name: redis - ports: - - containerPort: 6379 - name: redis - volumeMounts: - - mountPath: /redis-config - name: config - - mountPath: /redis-data - name: data - - command: [sh, -c, source /redis-config/sentinel.sh] - image: redis:3.2.7-alpine - name: sentinel - volumeMounts: - - mountPath: /redis-config - name: config - volumes: - - configMap: - defaultMode: 420 - name: redis-config - name: config - - emptyDir: - name: data diff --git a/14-2-parse-service.yaml b/14-2-parse-service.yaml deleted file mode 100644 index 2a6a29d..0000000 --- a/14-2-parse-service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: parse-server - namespace: default -spec: - ports: - - port: 1337 - protocol: TCP - targetPort: 1337 - selector: - run: parse-server diff --git a/14-3-ghost-config.js b/14-3-ghost-config.js deleted file mode 100644 index 71675ba..0000000 --- a/14-3-ghost-config.js +++ /dev/null @@ -1,25 +0,0 @@ -var path = require('path'), - config; - -config = { - development: { - url: 'http://localhost:2368', - database: { - client: 'sqlite3', - connection: { - filename: path.join(process.env.GHOST_CONTENT, - '/data/ghost-dev.db') - }, - debug: false - }, - server: { - host: '0.0.0.0', - port: '2368' - }, - paths: { - contentPath: path.join(process.env.GHOST_CONTENT, '/') - } - } -}; - -module.exports = config; diff --git a/14-4-ghost.yaml b/14-4-ghost.yaml deleted file mode 100644 index 02b9596..0000000 --- a/14-4-ghost.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: ghost -spec: - replicas: 1 - selector: - matchLabels: - run: ghost - template: - metadata: - labels: - run: ghost - spec: - containers: - - image: ghost - name: ghost - command: - - sh - - -c - - cp /ghost-config/ghost-config.js /var/lib/ghost/config.js - && docker-entrypoint.sh node current/index.js - volumeMounts: - - mountPath: /ghost-config - name: config - volumes: - - name: config - configMap: - defaultMode: 420 - name: ghost-config diff --git a/14-4-master.conf b/14-4-master.conf deleted file mode 100644 index 1924460..0000000 --- a/14-4-master.conf +++ /dev/null @@ -1,4 +0,0 @@ -bind 0.0.0.0 -port 6379 - -dir /redis-data diff --git a/14-5-slave.conf b/14-5-slave.conf deleted file mode 100644 index 87e300d..0000000 --- a/14-5-slave.conf +++ /dev/null @@ -1,6 +0,0 @@ -bind 0.0.0.0 -port 6379 - -dir . - -slaveof redis-0.redis 6379 diff --git a/14-6-sentinel.conf b/14-6-sentinel.conf deleted file mode 100644 index 10e4598..0000000 --- a/14-6-sentinel.conf +++ /dev/null @@ -1,7 +0,0 @@ -bind 0.0.0.0 -port 26379 - -sentinel monitor redis redis-0.redis 6379 2 -sentinel parallel-syncs redis 1 -sentinel down-after-milliseconds redis 10000 -sentinel failover-timeout redis 20000 diff --git a/14-7-init.sh b/14-7-init.sh deleted file mode 100644 index 738071a..0000000 --- a/14-7-init.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -if [[ ${HOSTNAME} == 'redis-0' ]]; then - redis-server /redis-config/master.conf -else - redis-server /redis-config/slave.conf -fi diff --git a/14-8-sentinel.sh b/14-8-sentinel.sh deleted file mode 100644 index 026f6e9..0000000 --- a/14-8-sentinel.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -while ! ping -c 1 redis-0.redis; do - echo 'Waiting for server' - sleep 1 -done - -redis-sentinel /redis-config/sentinel.conf - diff --git a/14-9-redis-service.yaml b/14-9-redis-service.yaml deleted file mode 100644 index 9f24a8c..0000000 --- a/14-9-redis-service.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: redis -spec: - ports: - - port: 6379 - name: peer - clusterIP: None - selector: - app: redis