Created
April 15, 2019 08:49
-
-
Save ajitatif/f83cb3640dda971472ca8b4fda00d650 to your computer and use it in GitHub Desktop.
A Simple Kubernetes Template
This file contains hidden or 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
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: <SERVICE_NAME>-<IMAGE_VERSION> | |
namespace: <NAMESPACE> | |
labels: | |
app: "<SERVICE_NAME>" | |
version: "<IMAGE_VERSION>" | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: "<SERVICE_NAME>" | |
version: "<IMAGE_VERSION>" | |
spec: | |
securityContext: | |
fsGroup: 99 | |
containers: | |
- name: <SERVICE_NAME> | |
image: <DOCKER_REPO>/<ENVIRONMENT>/<IMAGE_NAME>:<IMAGE_VERSION> | |
imagePullPolicy: Always | |
env: | |
- name: "TZ" | |
value: "Europe/Istanbul" | |
- name: "SPRING_PROFILES_ACTIVE" | |
value: "<PROFILES>" | |
- name : "JAVA_OPTS" | |
value: "-XX:+UseContainerSupport -XX:MaxMetaspaceSize=100m -Djava.awt.headless=true" | |
- name: "JAVA_TOOL_OPTIONS" | |
value: "-XX:+UseContainerSupport -XX:MaxMetaspaceSize=100m -Djava.awt.headless=true" | |
resources: | |
limits: | |
cpu: "1000m" | |
memory: "1Gi" | |
requests: | |
cpu: "500m" | |
memory: "512Mi" | |
ports: | |
- containerPort: 8080 | |
- containerPort: 8081 | |
readinessProbe: | |
initialDelaySeconds: 60 | |
periodSeconds: 2 | |
failureThreshold: 200 | |
httpGet: | |
path: /management/actuator/health | |
port: 8081 | |
livenessProbe: | |
initialDelaySeconds: 60 | |
periodSeconds: 10 | |
failureThreshold: 40 | |
httpGet: | |
path: /management/actuator/health | |
port: 8081 | |
--- | |
apiVersion: autoscaling/v1 | |
kind: HorizontalPodAutoscaler | |
metadata: | |
annotations: | |
name: <SERVICE_NAME>-<IMAGE_VERSION> | |
namespace: <NAMESPACE> | |
labels: | |
app: "<SERVICE_NAME>" | |
version: "<IMAGE_VERSION>" | |
spec: | |
maxReplicas: 1 | |
minReplicas: 1 | |
scaleTargetRef: | |
apiVersion: extensions/v1 | |
kind: Deployment | |
name: <SERVICE_NAME>-<IMAGE_VERSION> | |
targetCPUUtilizationPercentage: 50 | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: <SERVICE_NAME> | |
namespace: <NAMESPACE> | |
annotations: | |
nginx.ingress.kubernetes.io/rewrite-target: /$1 | |
nginx.ingress.kubernetes.io/ssl-redirect: "false" | |
spec: | |
rules: | |
- http: | |
paths: | |
- path: /<LISTEN_PATH>/?(.*) | |
backend: | |
serviceName: <SERVICE_NAME> | |
servicePort: 8080 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: <SERVICE_NAME> | |
namespace: <NAMESPACE> | |
labels: | |
app: "<SERVICE_NAME>" | |
spec: | |
ports: | |
- port: 8080 | |
targetPort: 8080 | |
protocol: TCP | |
name: http | |
selector: | |
app: "<SERVICE_NAME>" | |
version: "<IMAGE_VERSION>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment