kubernetes實踐之二十三:ReplicationController

百聯達發表於2018-04-24
一:體系結構圖


二:舉例
1. deployment.yaml

點選(此處)摺疊或開啟

  1. apiVersion: extensions/v1beta1
  2. kind: Deployment
  3. metadata:
  4.   name: desktop
  5.   labels:
  6.     app: desktop
  7. spec:
  8.     replicas: 2
  9.     selector:
  10.        matchLabels:
  11.             app: desktop
  12.     template:
  13.       metadata:
  14.           labels:
  15.             app: desktop
  16.       spec:
  17.          containers:
  18.          - name: desktop
  19.            image: 127.0.0.1:5000/tomcat:desktop
  20.            volumeMounts:
  21.            - name: jdkdir
  22.              mountPath: /usr/local/jdk
  23.            - name: uploaddir
  24.              mountPath: /mnt/upload
  25.            ports:
  26.            - containerPort: 8080
  27.          volumes:
  28.          - name: jdkdir
  29.            hostPath:
  30.               path: /mnt/devops/jdk1.8
  31.          - name: uploaddir
  32.            hostPath:
  33.              path: /mnt/upload
2.daemonSet.yaml

點選(此處)摺疊或開啟

  1. apiVersion: extensions/v1beta1
  2. kind: DaemonSet
  3. metadata:
  4.   name: desktop
  5.   labels:
  6.     app: desktop
  7. spec:
  8.     selector:
  9.        matchLabels:
  10.             app: desktop
  11.     template:
  12.       metadata:
  13.           labels:
  14.             app: desktop
  15.       spec:
  16.          containers:
  17.          - name: desktop
  18.            image: 127.0.0.1:5000/tomcat:desktop
  19.            volumeMounts:
  20.            - name: jdkdir
  21.              mountPath: /usr/local/jdk
  22.            - name: uploaddir
  23.              mountPath: /mnt/upload
  24.            ports:
  25.            - containerPort: 8080
  26.          volumes:
  27.          - name: jdkdir
  28.            hostPath:
  29.               path: /mnt/devops/jdk1.8
  30.          - name: uploaddir
  31.            hostPath:
  32.              path: /mnt/upload

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28624388/viewspace-2153290/,如需轉載,請註明出處,否則將追究法律責任。

相關文章