├── 10-1-job-oneshot.yaml ├── 10-2-job-oneshot-failure1.yaml ├── 10-3-job-parallel.yaml ├── 10-4-rs-queue.yaml ├── 10-5-service-queue.yaml ├── 10-6-load-queue.sh ├── 10-7-job-consumers.yaml ├── 11-1-simple-config.txt ├── 11-2-kuard-config.yaml ├── 11-3-kuard-secret.yaml ├── 11-4-kuard-secret-ips.yaml ├── 13-1-dns-service.yaml ├── 13-10-mongo-simple.yaml ├── 13-11-mongo-service.yaml ├── 13-12-mongo-configmap.yaml ├── 13-13-mongo.yaml ├── 13-2-external-ip-service.yaml ├── 13-3-external-ip-endpoints.yaml ├── 13-4-nfs-volume.yaml ├── 13-5-nfs-volume-claim.yaml ├── 13-6-mysql-replicaset.yaml ├── 13-7-mysql-service.yaml ├── 13-8-storageclass.yaml ├── 13-9-dynamic-volume-claim.yaml ├── 14-1-parse.yaml ├── 14-10-redis-service.yaml ├── 14-11-redis.yaml ├── 14-2-parse-service.yaml ├── 14-3-ghost-config.js ├── 14-4-ghost.yaml ├── 14-5-master.conf ├── 14-6-slave.conf ├── 14-7-sentinel.conf ├── 14-8-init.sh ├── 14-9-sentinel.sh ├── 5-1-kuard-pod.yaml ├── 5-2-kuard-pod-health.yaml ├── 5-3-kaurd-pod-resreq.yaml ├── 5-4-kaurd-pod-reslim.yaml ├── 5-5-kuard-pod-vol.yaml ├── 5-6-kuard-pod-full.yaml ├── 8-1-kuard-rs.yaml ├── 9-1-fluentd.yaml ├── 9-2-nginx-fast-storage.yaml ├── LICENSE └── README.md /10-1-job-oneshot.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: oneshot 5 | labels: 6 | chapter: jobs 7 | spec: 8 | template: 9 | metadata: 10 | labels: 11 | chapter: jobs 12 | spec: 13 | containers: 14 | - name: kuard 15 | image: gcr.io/kuar-demo/kuard-amd64:1 16 | imagePullPolicy: Always 17 | args: 18 | - "--keygen-enable" 19 | - "--keygen-exit-on-complete" 20 | - "--keygen-num-to-gen=10" 21 | restartPolicy: OnFailure 22 | -------------------------------------------------------------------------------- /10-2-job-oneshot-failure1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: oneshot 5 | labels: 6 | chapter: jobs 7 | spec: 8 | template: 9 | metadata: 10 | labels: 11 | chapter: jobs 12 | spec: 13 | containers: 14 | - name: kuard 15 | image: gcr.io/kuar-demo/kuard-amd64:1 16 | imagePullPolicy: Always 17 | args: 18 | - "--keygen-enable" 19 | - "--keygen-exit-on-complete" 20 | - "--keygen-exit-code=1" 21 | - "--keygen-num-to-gen=3" 22 | restartPolicy: OnFailure 23 | -------------------------------------------------------------------------------- /10-3-job-parallel.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: parallel 5 | labels: 6 | chapter: jobs 7 | spec: 8 | parallelism: 5 9 | completions: 10 10 | template: 11 | metadata: 12 | labels: 13 | chapter: jobs 14 | spec: 15 | containers: 16 | - name: kuard 17 | image: gcr.io/kuar-demo/kuard-amd64:1 18 | imagePullPolicy: Always 19 | args: 20 | - "--keygen-enable" 21 | - "--keygen-exit-on-complete" 22 | - "--keygen-num-to-gen=10" 23 | restartPolicy: OnFailure 24 | -------------------------------------------------------------------------------- /10-4-rs-queue.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | labels: 5 | app: work-queue 6 | component: queue 7 | chapter: jobs 8 | name: queue 9 | spec: 10 | selector: 11 | matchLabels: 12 | app: work-queue 13 | component: queue 14 | chapter: jobs 15 | replicas: 1 16 | template: 17 | metadata: 18 | labels: 19 | app: work-queue 20 | component: queue 21 | chapter: jobs 22 | spec: 23 | containers: 24 | - name: queue 25 | image: "gcr.io/kuar-demo/kuard-amd64:1" 26 | imagePullPolicy: Always 27 | -------------------------------------------------------------------------------- /10-5-service-queue.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | app: work-queue 6 | component: queue 7 | chapter: jobs 8 | name: queue 9 | spec: 10 | ports: 11 | - port: 8080 12 | protocol: TCP 13 | targetPort: 8080 14 | selector: 15 | app: work-queue 16 | component: queue 17 | -------------------------------------------------------------------------------- /10-6-load-queue.sh: -------------------------------------------------------------------------------- 1 | 2 | # 'keygen' というキューを作成 3 | curl -X PUT localhost:8080/memq/server/queues/keygen 4 | 5 | # サブタスク(work item) を100 個作ってキューに入れる 6 | for i in work-item-{0..99}; do 7 | curl -X POST localhost:8080/memq/server/queues/keygen/enqueue \ 8 | -d "$i" 9 | done 10 | -------------------------------------------------------------------------------- /10-7-job-consumers.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | labels: 5 | app: message-queue 6 | component: consumer 7 | chapter: jobs 8 | name: consumers 9 | spec: 10 | parallelism: 5 11 | template: 12 | metadata: 13 | labels: 14 | app: message-queue 15 | component: consumer 16 | chapter: jobs 17 | spec: 18 | containers: 19 | - name: worker 20 | image: "gcr.io/kuar-demo/kuard-amd64:1" 21 | imagePullPolicy: Always 22 | args: 23 | - "--keygen-enable" 24 | - "--keygen-exit-on-complete" 25 | - "--keygen-memq-server=http://queue:8080/memq/server" 26 | - "--keygen-memq-queue=keygen" 27 | restartPolicy: OnFailure 28 | -------------------------------------------------------------------------------- /11-1-simple-config.txt: -------------------------------------------------------------------------------- 1 | # アプリケーションの設定に使用する設定ファイルのサンプル 2 | parameter1 = value1 3 | parameter2 = value2 4 | -------------------------------------------------------------------------------- /11-2-kuard-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard-config 5 | spec: 6 | containers: 7 | - name: test-container 8 | image: gcr.io/kuar-demo/kuard-amd64:1 9 | imagePullPolicy: Always 10 | command: 11 | - "/kuard" 12 | - "$(EXTRA_PARAM)" 13 | env: 14 | - name: ANOTHER_PARAM 15 | valueFrom: 16 | configMapKeyRef: 17 | name: my-config 18 | key: another-param 19 | - name: EXTRA_PARAM 20 | valueFrom: 21 | configMapKeyRef: 22 | name: my-config 23 | key: extra-param 24 | volumeMounts: 25 | - name: config-volume 26 | mountPath: /config 27 | volumes: 28 | - name: config-volume 29 | configMap: 30 | name: my-config 31 | restartPolicy: Never 32 | -------------------------------------------------------------------------------- /11-3-kuard-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard-tls 5 | spec: 6 | containers: 7 | - name: kuard-tls 8 | image: gcr.io/kuar-demo/kuard-amd64:1 9 | imagePullPolicy: Always 10 | volumeMounts: 11 | - name: tls-certs 12 | mountPath: "/tls" 13 | readOnly: true 14 | volumes: 15 | - name: tls-certs 16 | secret: 17 | secretName: kuard-tls 18 | -------------------------------------------------------------------------------- /11-4-kuard-secret-ips.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard-tls 5 | spec: 6 | containers: 7 | - name: kuard-tls 8 | image: gcr.io/kuar-demo/kuard-amd64:1 9 | imagePullPolicy: Always 10 | volumeMounts: 11 | - name: tls-certs 12 | mountPath: "/tls" 13 | readOnly: true 14 | imagePullSecrets: 15 | - name: my-image-pull-secret 16 | volumes: 17 | - name: tls-certs 18 | secret: 19 | secretName: kuard-tls 20 | -------------------------------------------------------------------------------- /13-1-dns-service.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | name: external-database 5 | spec: 6 | type: ExternalName 7 | externalName: "database.company.com" 8 | -------------------------------------------------------------------------------- /13-10-mongo-simple.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: mongo 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: mongo 9 | serviceName: "mongo" 10 | replicas: 3 11 | template: 12 | metadata: 13 | labels: 14 | app: mongo 15 | spec: 16 | containers: 17 | - name: mongodb 18 | image: mongo:3.4.1 19 | command: 20 | - mongod 21 | - --replSet 22 | - rs0 23 | ports: 24 | - containerPort: 27017 25 | name: peer 26 | -------------------------------------------------------------------------------- /13-11-mongo-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: mongo 5 | spec: 6 | ports: 7 | - port: 27017 8 | name: peer 9 | clusterIP: None 10 | selector: 11 | app: mongo 12 | -------------------------------------------------------------------------------- /13-12-mongo-configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: mongo-init 5 | data: 6 | init.sh: | 7 | #!/bin/bash 8 | 9 | # 名前解決ができるよう、Readiness probe が成功するのを待つ必要がある。 10 | # あまりよくない方法。 11 | until ping -c 1 ${HOSTNAME}.mongo; do 12 | echo "waiting for DNS (${HOSTNAME}.mongo)..." 13 | sleep 2 14 | done 15 | 16 | until /usr/bin/mongo --eval 'printjson(db.serverStatus())'; do 17 | echo "connecting to local mongo..." 18 | sleep 2 19 | done 20 | echo "connected to local." 21 | 22 | HOST=mongo-0.mongo:27017 23 | 24 | until /usr/bin/mongo --host=${HOST} --eval 'printjson(db.serverStatus())'; do 25 | echo "connecting to remote mongo..." 26 | sleep 2 27 | done 28 | echo "connected to remote." 29 | 30 | if [[ "${HOSTNAME}" != 'mongo-0' ]]; then 31 | until /usr/bin/mongo --host=${HOST} --eval="printjson(rs.status())" \ 32 | | grep -v "no replset config has been received"; do 33 | echo "waiting for replication set initialization" 34 | sleep 2 35 | done 36 | echo "adding self to mongo-0" 37 | /usr/bin/mongo --host=${HOST} \ 38 | --eval="printjson(rs.add('${HOSTNAME}.mongo'))" 39 | fi 40 | 41 | if [[ "${HOSTNAME}" == 'mongo-0' ]]; then 42 | echo "initializing replica set" 43 | /usr/bin/mongo --eval="printjson(rs.initiate(\ 44 | {'_id': 'rs0', 'members': [{'_id': 0, \ 45 | 'host': 'mongo-0.mongo:27017'}]}))" 46 | fi 47 | echo "initialized" 48 | 49 | while true; do 50 | sleep 3600 51 | done 52 | -------------------------------------------------------------------------------- /13-13-mongo.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: mongo 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: mongo 9 | serviceName: "mongo" 10 | replicas: 3 11 | template: 12 | metadata: 13 | labels: 14 | app: mongo 15 | spec: 16 | containers: 17 | - name: mongodb 18 | image: mongo:3.4.1 19 | command: 20 | - mongod 21 | - --replSet 22 | - rs0 23 | ports: 24 | - containerPort: 27017 25 | name: web 26 | # このコンテナはmongodb を初期化した後、スリープする 27 | - name: init-mongo 28 | image: mongo:3.4.1 29 | command: 30 | - bash 31 | - /config/init.sh 32 | volumeMounts: 33 | - name: config 34 | mountPath: /config 35 | volumes: 36 | - name: config 37 | configMap: 38 | name: "mongo-init" 39 | -------------------------------------------------------------------------------- /13-2-external-ip-service.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | name: external-ip-database 5 | spec: 6 | ports: 7 | - port: 3306 8 | targetPort: 3306 9 | -------------------------------------------------------------------------------- /13-3-external-ip-endpoints.yaml: -------------------------------------------------------------------------------- 1 | kind: Endpoints 2 | apiVersion: v1 3 | metadata: 4 | name: external-ip-database 5 | subsets: 6 | - addresses: 7 | - ip: 192.168.0.1 8 | ports: 9 | - port: 3306 10 | -------------------------------------------------------------------------------- /13-4-nfs-volume.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolume 3 | metadata: 4 | name: database 5 | labels: 6 | volume: my-volume 7 | spec: 8 | accessModes: 9 | - ReadWriteOnce 10 | capacity: 11 | storage: 1Gi 12 | nfs: 13 | server: 192.168.0.1 14 | path: "/exports" 15 | -------------------------------------------------------------------------------- /13-5-nfs-volume-claim.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | name: database 5 | spec: 6 | accessModes: 7 | - ReadWriteOnce 8 | resources: 9 | requests: 10 | storage: 1Gi 11 | selector: 12 | matchLabels: 13 | volume: my-volume 14 | -------------------------------------------------------------------------------- /13-6-mysql-replicaset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: mysql 5 | # ServiceをこのPodに割り当てるためのLabel 6 | labels: 7 | app: mysql 8 | spec: 9 | replicas: 1 10 | selector: 11 | matchLabels: 12 | app: mysql 13 | template: 14 | metadata: 15 | labels: 16 | app: mysql 17 | spec: 18 | containers: 19 | - name: database 20 | image: mysql 21 | resources: 22 | requests: 23 | cpu: 1 24 | memory: 2Gi 25 | env: 26 | # セキュリティ的には環境変数を使うのはベストプラクティスとは言えませんが、 27 | # 分かりやすさを優先しています。 28 | # よりよい方法が何かは11章を見て下さい。 29 | - name: MYSQL_ROOT_PASSWORD 30 | value: some-password-here 31 | livenessProbe: 32 | tcpSocket: 33 | port: 3306 34 | ports: 35 | - containerPort: 3306 36 | volumeMounts: 37 | - name: database 38 | # /var/lib/mysql は、MySQLがデータベース自体を置く場所 39 | mountPath: "/var/lib/mysql" 40 | volumes: 41 | - name: database 42 | persistentVolumeClaim: 43 | claimName: database 44 | -------------------------------------------------------------------------------- /13-7-mysql-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: mysql 5 | spec: 6 | ports: 7 | - port: 3306 8 | protocol: TCP 9 | selector: 10 | app: mysql 11 | -------------------------------------------------------------------------------- /13-8-storageclass.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: storage.k8s.io/v1 2 | kind: StorageClass 3 | metadata: 4 | name: default 5 | annotations: 6 | storageclass.beta.kubernetes.io/is-default-class: "true" 7 | labels: 8 | kubernetes.io/cluster-service: "true" 9 | provisioner: kubernetes.io/azure-disk 10 | -------------------------------------------------------------------------------- /13-9-dynamic-volume-claim.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | name: my-claim 5 | annotations: 6 | volume.beta.kubernetes.io/storage-class: default 7 | spec: 8 | accessModes: 9 | - ReadWriteOnce 10 | resources: 11 | requests: 12 | storage: 10Gi 13 | -------------------------------------------------------------------------------- /14-1-parse.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: parse-server 5 | namespace: default 6 | spec: 7 | selector: 8 | matchLabels: 9 | run: parse-server 10 | replicas: 1 11 | template: 12 | metadata: 13 | labels: 14 | run: parse-server 15 | spec: 16 | containers: 17 | - name: parse-server 18 | image: ${DOCKER_USER}/parse-server 19 | env: 20 | - name: DATABASE_URI 21 | value: "mongodb://mongo-0.mongo:27017,\ 22 | mongo-1.mongo:27017,mongo-2.mongo\ 23 | :27017/dev?replicaSet=rs0" 24 | - name: APPLICATION_ID 25 | value: my-app-id 26 | - name: MASTER_KEY 27 | value: my-master-key 28 | -------------------------------------------------------------------------------- /14-10-redis-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: redis 5 | spec: 6 | ports: 7 | - port: 6379 8 | name: peer 9 | clusterIP: None 10 | selector: 11 | app: redis 12 | -------------------------------------------------------------------------------- /14-11-redis.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: redis 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: redis 9 | replicas: 3 10 | serviceName: redis 11 | template: 12 | metadata: 13 | labels: 14 | app: redis 15 | spec: 16 | containers: 17 | - command: [sh, -c, source /redis-config/init.sh ] 18 | image: redis:3.2.7-alpine 19 | name: redis 20 | ports: 21 | - containerPort: 6379 22 | name: redis 23 | volumeMounts: 24 | - mountPath: /redis-config 25 | name: config 26 | - mountPath: /redis-data 27 | name: data 28 | - command: [sh, -c, source /redis-config/sentinel.sh] 29 | image: redis:3.2.7-alpine 30 | name: sentinel 31 | volumeMounts: 32 | - mountPath: /redis-config 33 | name: config 34 | volumes: 35 | - configMap: 36 | defaultMode: 420 37 | name: redis-config 38 | name: config 39 | - emptyDir: 40 | name: data 41 | -------------------------------------------------------------------------------- /14-2-parse-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: parse-server 5 | namespace: default 6 | spec: 7 | ports: 8 | - port: 1337 9 | protocol: TCP 10 | targetPort: 1337 11 | selector: 12 | run: parse-server 13 | -------------------------------------------------------------------------------- /14-3-ghost-config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'), 2 | config; 3 | 4 | config = { 5 | development: { 6 | url: 'http://localhost:2368', 7 | database: { 8 | client: 'sqlite3', 9 | connection: { 10 | filename: path.join(process.env.GHOST_CONTENT, 11 | '/data/ghost-dev.db') 12 | }, 13 | debug: false 14 | }, 15 | server: { 16 | host: '0.0.0.0', 17 | port: '2368' 18 | }, 19 | paths: { 20 | contentPath: path.join(process.env.GHOST_CONTENT, '/') 21 | } 22 | } 23 | }; 24 | 25 | module.exports = config; 26 | -------------------------------------------------------------------------------- /14-4-ghost.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: ghost 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | run: ghost 10 | template: 11 | metadata: 12 | labels: 13 | run: ghost 14 | spec: 15 | containers: 16 | - image: ghost:0 17 | name: ghost 18 | command: 19 | - sh 20 | - -c 21 | - cp /ghost-config/ghost-config.js /var/lib/ghost/config.js 22 | && docker-entrypoint.sh npm start 23 | volumeMounts: 24 | - mountPath: /ghost-config 25 | name: config 26 | volumes: 27 | - name: config 28 | configMap: 29 | defaultMode: 420 30 | name: ghost-config 31 | -------------------------------------------------------------------------------- /14-5-master.conf: -------------------------------------------------------------------------------- 1 | bind 0.0.0.0 2 | port 6379 3 | 4 | dir /redis-data 5 | -------------------------------------------------------------------------------- /14-6-slave.conf: -------------------------------------------------------------------------------- 1 | bind 0.0.0.0 2 | port 6379 3 | 4 | dir . 5 | 6 | slaveof redis-0.redis 6379 7 | -------------------------------------------------------------------------------- /14-7-sentinel.conf: -------------------------------------------------------------------------------- 1 | bind 0.0.0.0 2 | port 26379 3 | 4 | sentinel monitor redis redis-0.redis 6379 2 5 | sentinel parallel-syncs redis 1 6 | sentinel down-after-milliseconds redis 10000 7 | sentinel failover-timeout redis 20000 8 | -------------------------------------------------------------------------------- /14-8-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [[ ${HOSTNAME} == 'redis-0' ]]; then 3 | redis-server /redis-config/master.conf 4 | else 5 | redis-server /redis-config/slave.conf 6 | fi 7 | -------------------------------------------------------------------------------- /14-9-sentinel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | while ! ping -c 1 redis-0.redis; do 3 | echo 'Waiting for server' 4 | sleep 1 5 | done 6 | 7 | redis-sentinel /redis-config/sentinel.conf 8 | 9 | -------------------------------------------------------------------------------- /5-1-kuard-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard 5 | spec: 6 | containers: 7 | - image: gcr.io/kuar-demo/kuard-amd64:1 8 | name: kuard 9 | ports: 10 | - containerPort: 8080 11 | name: http 12 | protocol: TCP 13 | -------------------------------------------------------------------------------- /5-2-kuard-pod-health.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard 5 | spec: 6 | containers: 7 | - image: gcr.io/kuar-demo/kuard-amd64:1 8 | name: kuard 9 | livenessProbe: 10 | httpGet: 11 | path: /healthy 12 | port: 8080 13 | initialDelaySeconds: 5 14 | timeoutSeconds: 1 15 | periodSeconds: 10 16 | failureThreshold: 3 17 | ports: 18 | - containerPort: 8080 19 | name: http 20 | protocol: TCP 21 | -------------------------------------------------------------------------------- /5-3-kaurd-pod-resreq.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard 5 | spec: 6 | containers: 7 | - image: gcr.io/kuar-demo/kuard-amd64:1 8 | name: kuard 9 | resources: 10 | requests: 11 | cpu: "500m" 12 | memory: "128Mi" 13 | ports: 14 | - containerPort: 8080 15 | name: http 16 | protocol: TCP 17 | -------------------------------------------------------------------------------- /5-4-kaurd-pod-reslim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard 5 | spec: 6 | containers: 7 | - image: gcr.io/kuar-demo/kuard-amd64:1 8 | name: kuard 9 | resources: 10 | requests: 11 | cpu: "500m" 12 | memory: "128Mi" 13 | limits: 14 | cpu: "1000m" 15 | memory: "256Mi" 16 | ports: 17 | - containerPort: 8080 18 | name: http 19 | protocol: TCP 20 | -------------------------------------------------------------------------------- /5-5-kuard-pod-vol.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard 5 | spec: 6 | volumes: 7 | - name: "kuard-data" 8 | hostPath: 9 | path: "/var/lib/kuard" 10 | containers: 11 | - image: gcr.io/kuar-demo/kuard-amd64:1 12 | name: kuard 13 | volumeMounts: 14 | - mountPath: "/data" 15 | name: "kuard-data" 16 | ports: 17 | - containerPort: 8080 18 | name: http 19 | protocol: TCP 20 | -------------------------------------------------------------------------------- /5-6-kuard-pod-full.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: kuard 5 | spec: 6 | volumes: 7 | - name: "kuard-data" 8 | nfs: 9 | server: my.nfs.server.local 10 | path: "/exports" 11 | containers: 12 | - image: gcr.io/kuar-demo/kuard-amd64:1 13 | name: kuard 14 | ports: 15 | - containerPort: 8080 16 | name: http 17 | protocol: TCP 18 | resources: 19 | requests: 20 | cpu: "500m" 21 | memory: "128Mi" 22 | limits: 23 | cpu: "1000m" 24 | memory: "256Mi" 25 | volumeMounts: 26 | - mountPath: "/data" 27 | name: "kuard-data" 28 | livenessProbe: 29 | httpGet: 30 | path: /healthy 31 | port: 8080 32 | initialDelaySeconds: 5 33 | timeoutSeconds: 1 34 | periodSeconds: 10 35 | failureThreshold: 3 36 | readinessProbe: 37 | httpGet: 38 | path: /ready 39 | port: 8080 40 | initialDelaySeconds: 30 41 | timeoutSeconds: 1 42 | periodSeconds: 10 43 | failureThreshold: 3 44 | -------------------------------------------------------------------------------- /8-1-kuard-rs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: kuard 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: kuard 9 | version: "2" 10 | replicas: 1 11 | template: 12 | metadata: 13 | labels: 14 | app: kuard 15 | version: "2" 16 | spec: 17 | containers: 18 | - name: kuard 19 | image: "gcr.io/kuar-demo/kuard-amd64:2" 20 | -------------------------------------------------------------------------------- /9-1-fluentd.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: DaemonSet 3 | metadata: 4 | name: fluentd 5 | namespace: kube-system 6 | labels: 7 | app: fluentd 8 | spec: 9 | selector: 10 | matchLabels: 11 | app: fluentd 12 | template: 13 | metadata: 14 | labels: 15 | app: fluentd 16 | spec: 17 | containers: 18 | - name: fluentd 19 | image: fluent/fluentd:v0.14.10 20 | resources: 21 | limits: 22 | memory: 200Mi 23 | requests: 24 | cpu: 100m 25 | memory: 200Mi 26 | volumeMounts: 27 | - name: varlog 28 | mountPath: /var/log 29 | - name: varlibdockercontainers 30 | mountPath: /var/lib/docker/containers 31 | readOnly: true 32 | terminationGracePeriodSeconds: 30 33 | volumes: 34 | - name: varlog 35 | hostPath: 36 | path: /var/log 37 | - name: varlibdockercontainers 38 | hostPath: 39 | path: /var/lib/docker/containers 40 | -------------------------------------------------------------------------------- /9-2-nginx-fast-storage.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: "DaemonSet" 3 | metadata: 4 | labels: 5 | app: nginx 6 | ssd: "true" 7 | name: nginx-fast-storage 8 | spec: 9 | selector: 10 | matchLabels: 11 | app: nginx 12 | ssd: "true" 13 | template: 14 | metadata: 15 | labels: 16 | app: nginx 17 | ssd: "true" 18 | spec: 19 | nodeSelector: 20 | ssd: "true" 21 | containers: 22 | - name: nginx 23 | image: nginx:1.10.0 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 「入門Kubernetes」サンプルファイル Kubernetes 1.9対応版 2 | 3 | - **[正誤表](https://github.com/doublemarket/kuar-examples-1-9/wiki/Errata)** 4 | - **書籍の[補完資料](https://speakerdeck.com/doublemarket/20180609-gcpug-hiroshima-number-4?slide=1)** 5 | - 読みながらこの資料の図を見ると分かりやすいように作りました。 6 | 7 | このリポジトリは、オライリー・ジャパン「[入門Kubernetes](https://www.oreilly.co.jp/books/9784873118406/)」の原著である「[Kubernetes: Up and Running](http://shop.oreilly.com/product/0636920043874.do)」で提供されている[サンプルファイル](https://github.com/kubernetes-up-and-running/examples)を、Kubernetes 1.9に対応させて独自に公開しているものです。 8 | 9 | [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)に置かれているファイルの間違いを修正したり、原著の執筆当時から古くなってしまっている情報を2018年2月時点の情報に更新してあります。 10 | 11 | ファイル名の命名規則は原則的に「リスト番号-ファイル名」になっていますが、本文ではリスト番号部分が省かれて書いてあります。ファイル同士が参照する場合もリスト番号なしのファイル名を使用しているので、実際に動かしてみる時はリスト番号を削除してください。 12 | 13 | ``` 14 | # 例 15 | mv 5-1-kuard-pod.yaml kuard-pod.yaml 16 | ``` 17 | 18 | ## 第5章 19 | 20 | ### [5-1-kuard-pod.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-1bc7072333fe19f8584dd9c82b6ea7f2) 21 | 22 | - インデントの間違いを修正しています。 23 | - ファイル内に記載されている`my.nfs.server.local`というホスト名で名前解決できるNFSサーバを別途用意する必要があります。 24 | 25 | ## 第8章 26 | 27 | ### [8-1-kuard-rs.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-22de4a705ef4ffebb016c2f1c12eb341) 28 | 29 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 30 | 31 | ## 第9章 32 | 33 | ### [9-1-fluentd.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-792e87fc47efc8a5ac879c49902a0083) 34 | 35 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 36 | 37 | ### [9-2-nginx-fast-storage.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-e101f6c7cdcf81221b5ca46df7a78fe7) 38 | 39 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 40 | 41 | ## 第10章 42 | 43 | ### [10-4-rs-queue.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-30d4e8102cf9a725a304aabfd757f542) 44 | 45 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 46 | 47 | ### [10-6-load-queue.sh](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-5f473e8f3e6129a2a3349f36f4a529c9) 48 | 49 | - コメントを日本語化しています。 50 | 51 | ## 第11章 52 | 53 | ### [11-1-simple-config.txt](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-046a9195796b47fa8d87e1126ca8729a) 54 | 55 | - コメントを日本語化しています。 56 | 57 | ### [11-4-kuard-secret-ips.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-8d0188336a3f426178516b98d04e7ce9) 58 | 59 | - インデントの間違いを修正しています。 60 | 61 | ## 第13章 62 | 63 | ### [13-1-dns-service.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-4fba49be14827db44a76f21e86b1aecb) 64 | 65 | - ダブルクォーテーション(`"`)の閉じ忘れを修正しています。 66 | 67 | ### [13-2-external-ip-service.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-27db68f74a295532b6e702650d06e73f) 68 | 69 | - `spec.ports`が必須なため追加しています。 70 | 71 | ### [13-4-nfs-volume.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-af622f3068ca6e5719801f966ad01bbd) 72 | 73 | - ファイル内に記載されている`192.168.0.1`のNFSサーバを別途用意する必要があります。 74 | - `spec.accessModes`が必須なため追加しています。 75 | 76 | ### [13-5-nfs-volume-claim.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-5f357799ed4cd2adea12b46db91f713e) 77 | 78 | - `spec.accessModes`が必須なため追加しています。 79 | 80 | ### [13-6-mysql-replicaset.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-03539dd891431426e39ab89e064db14d) 81 | 82 | - APIバージョンを変更(`extensions/v1beta1`から`apps/v1`)しています。 83 | - コメントを日本語化しています。 84 | 85 | ### [13-8-storageclass.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-a71fda3c7a21778a464d51cfee3b7f7e) 86 | 87 | - APIバージョンを変更(`storage.k8s.io/v1beta1`から`storage.k8s.io/v1`)しています。 88 | 89 | ### [13-10-mongo-simple.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-98c157a35ca3453817cc231c5f74659e) 90 | 91 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 92 | 93 | ### [13-12-mongo-configmap.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-219ffde782167bb8a3fed7587830cdca) 94 | 95 | - コメントを日本語化しています。 96 | 97 | ### [13-13-mongo.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-c2367f81f6ed9b8838013e2b53a52238) 98 | 99 | - APIバージョンの変更(`apps/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 100 | - コメントを日本語化しています。 101 | 102 | ## 第14章 103 | 104 | 105 | ### [14-1-parse.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-0d188bf328e1e92efc0f44bc4cc73b4a) 106 | 107 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 108 | - 環境変数名が`APP_ID`となっていたのを、`APPLICATION_ID`に修正しています。 109 | 110 | ### [14-2-parse-service.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-7c6544fc2f7cbce3905b5bb70727c3af) 111 | 112 | - ファイル名のドット(`.`)がカンマ(`,`)になっていたのを修正しています。 113 | 114 | ### [14-4-ghost.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-8ba5dcb8577531ea355979b5659294dd) 115 | 116 | - APIバージョンの変更(`extensions/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 117 | - Ghostのバージョンが変わったこと(0.11.xから1.21.x)に追随するよう変更を加えました。 118 | - イメージのバージョンを明示的に指定しました。 119 | - 起動スクリプトのファイル名を変更しました。 120 | 121 | なお、本文中では暗黙的にGhost 0.11.xを使用する前提になっていますが、以下のように変更することでGhost 1.21.xを使用できます。 122 | 123 | - 変更前(0.11.x) 124 | 125 | ``` 126 | spec: 127 | containers: 128 | - image: ghost:0 129 | name: ghost 130 | command: 131 | - sh 132 | - -c 133 | - cp /ghost-config/ghost-config.js /var/lib/ghost/config.js 134 | && docker-entrypoint.sh npm start 135 | ``` 136 | 137 | - 変更後(1.21.x) 138 | 139 | ``` 140 | spec: 141 | containers: 142 | - image: ghost 143 | name: ghost 144 | command: 145 | - sh 146 | - -c 147 | - cp /ghost-config/ghost-config.js /var/lib/ghost/config.js 148 | && docker-entrypoint.sh node current/index.js 149 | ``` 150 | 151 | ### [14-5-master.conf](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-b1a74cab921c96f447928d1b2c89f861) 152 | 153 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 154 | 155 | ### [14-6-slave.conf](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-05a73d1410c72b096f647a1b78aeec4d) 156 | 157 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 158 | 159 | ### [14-7-sentinel.conf](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-c378b882efef9ebffe7faa3d5a84cf8a) 160 | 161 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 162 | 163 | ### [14-8-init.sh](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-463e9b54089edd190993a102a104d3db) 164 | 165 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 166 | 167 | ### [14-9-sentinel.sh](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-1c1b9a54f0f996a13f8b0209657dbfb1) 168 | 169 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 170 | 171 | ### [14-10-redis-service.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-e501b708dad19e941f99785642965797) 172 | 173 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 174 | - APIバージョンの変更(`apps/v1beta1`から`apps/v1`)と、それに伴う`spec.selector`を追加しています。 175 | 176 | ### [14-11-redis.yaml](https://github.com/doublemarket/kuar-example-1-9-temp/compare/36f0aa615b10617fea5f75ad0bf69d89d35b4164...master#diff-7fa50e3da9de29b501a6ede3f4b8708f) 177 | 178 | - [元になったリポジトリ](https://github.com/kubernetes-up-and-running/examples)でファイル名のリスト番号部分が間違っているのを修正しています。 179 | --------------------------------------------------------------------------------