kubernetes

This commit is contained in:
xcad2k 2021-08-19 15:53:13 +02:00
parent dec4694578
commit 891907bd41
10 changed files with 100 additions and 0 deletions

View File

View File

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: appname # Name of the deployment
namespace: namespace # Name of the namespace
labels:
app: appname # Name of your application
spec:
selector:
matchLabels:
app: appname # Name of your application
replicas: 1 # Number of replicas
template:
metadata:
labels:
app: appname # Name of your application
spec:
containers:
# Containers are the individual pieces of your application that you want
# to run.
- name: helloworld # Name of the container
image: helloworld:latest # The image you want to run
# resources:
# limits:
# memory: 512Mi
# cpu: "1"
# requests:
# memory: 256Mi
# cpu: "0.2"
ports:
# Ports are the ports that your application uses.
- containerPort: 8080 # The port that your application uses
volumeMounts:
# VolumeMounts are the volumes that your application uses.
- mountPath: /var/www/html # The path that your application uses
name: vol0 # Name of the volume
volumes:
# Volumes are the persistent storage that your application uses.
- name: vol0 # Name of the volume
persistentVolumeClaim:
claimName: pvc0 # Name of the persistent volume claim

View File

View File

@ -0,0 +1,27 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc0
namespace: namespace
labels:
app: namespace
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
# ---
# Digital Ocean
# storageClassName: do-block-storage
# ---
# AWS
# storageClassName: aws-ebs
# ---
# Azure
# storageClassName: azure-disk
# ---
# GCE PD
# storageClassName: gce-pd
# ---

View File

@ -0,0 +1,32 @@
apiVersion: v1
kind: Service
metadata:
name: servicename
namespace: namespace
spec:
selector:
app: appname
# ---
# type: ClusterIP
# ClusterIP means this service can be accessed by any pod in the cluster
# ports:
# - name: http
# port: 8080
# targetPort: 80
# protocol: TCP # optional protocol
# ---
# type: NodePort
# NodePort means this service is only accessible by pods in the same namespace
# ports:
# - name: http
# port: 80
# nodePort: 30001
# protocol: TCP # optional protocol
# ---
# type: LoadBalancer
# LoadBalancer means this service is load-balanced across all nodes in the cluster
# ports:
# - name: http
# port: 80
# targetPort: 30001
# protocol: TCP # optional protocol