Last active
November 20, 2019 18:51
-
-
Save EmilyM1/7ff7d5c53ceb961f886554ff6a15d99e to your computer and use it in GitHub Desktop.
Deploy,PV,PVC,Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# minikube, apply vs create | |
# deploy ghost publishing platform | |
# maintain data at container startsand restarts mounts volume | |
# auto scale up cpu | |
apiVersion: extensions/v1beta1 | |
kind: Deployment # rolls out replicaset | |
metadata: | |
name: ghost | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: ghost #this is how the deployment finds pods to manage | |
template: | |
metadata: | |
labels: | |
app: ghost # this namesthe pod | |
spec: #template spec section | |
containers: # the pod container, the container spec is in the deployment | |
- name: ghost | |
image: ghost | |
ports: | |
- containerPort: 2368 | |
volumeMounts: | |
- mountPath: /var/lib/ghost/content | |
name: ghost-volumes | |
volumes: | |
- name: ghost-volumes | |
persistentVolumeClaim: | |
claimName: ghost-volume-claim | |
--- | |
apiVersion: v1 | |
kind: PersistentVolume # storage class, NSF, ceph, aws | |
metadata: | |
name: ghost-volumes | |
labels: | |
type: local | |
spec: | |
storageClassName: manual | |
capacity: | |
storage: 10Gi | |
accessModes: | |
- ReadWriteOnce #ReadWriteOnce, ReadWriteMany, ReadOnlyMany (read only by many nodes) | |
hostPath: | |
path: /var/lib/ghost/content | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim # the request for PV, specify storage size and accessModes, binds to PV | |
metadata: | |
name: ghost-volume-claim | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 8Gi | |
--- | |
apiVersion: v1 | |
kind: Service #expose pods over network, pods have own IPaddress | |
metadata: | |
name: ghost-service | |
labels: | |
app: ghost | |
spec: | |
selector: | |
app: ghost | |
tier: frontend | |
ports: | |
- protocol: TCP | |
port: 80 | |
type: NodePort #ClusterIP within cluster, NodePort static port on Node, LoadBalancer, clouds LB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment