Created
February 21, 2023 19:05
-
-
Save joseabraham/78d0203d4c8a102f4e8eb4e20cd98d01 to your computer and use it in GitHub Desktop.
Kubernetes LKE resources Node.js - Redis Load Balancer
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: v1 | |
kind: Secret | |
metadata: | |
name: regcred | |
data: | |
.dockerconfigjson: DOCKER_CONFIG | |
type: kubernetes.io/dockerconfigjson | |
--- | |
# This section will create a deployment in the Kubernetes cluster | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: linode-deploy | |
labels: | |
app: linode-app | |
spec: | |
selector: | |
matchLabels: | |
app: linode-app | |
replicas: 1 | |
strategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxSurge: 1 | |
maxUnavailable: 0 | |
template: | |
metadata: | |
labels: | |
app: linode-app | |
spec: | |
containers: | |
- name: linode-app | |
image: IMAGE_NAME | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 3300 | |
env: | |
- name: JWT_TOKEN_SECRET | |
value: JWT_TOKEN_SECRET_VAL | |
- name: JWT_TOKEN_SECRET_API | |
value: JWT_TOKEN_SECRET_API_VAL | |
- name: MONGO_URL | |
value: MONGO_URL_VAL | |
- name: MONGO_URL_DEFI | |
value: MONGO_URL_DEFI_VAL | |
imagePullSecrets: | |
- name: regcred | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: redis | |
spec: | |
selector: | |
matchLabels: | |
app: redis | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: redis | |
spec: | |
volumes: | |
- name: host-sys | |
hostPath: | |
path: /sys | |
initContainers: | |
- name: disable-thp | |
image: redis:4.0-alpine | |
volumeMounts: | |
- name: host-sys | |
mountPath: /host-sys | |
command: ["sh", "-c", "echo never > /host-sys/kernel/mm/transparent_hugepage/enabled"] | |
containers: | |
- name: redis | |
image: redis:4.0-alpine | |
imagePullPolicy: IfNotPresent | |
resources: | |
requests: | |
cpu: 350m | |
memory: 1024Mi | |
ports: | |
- containerPort: 6379 | |
--- | |
# # This section will create a service in the Kubernetes cluster | |
# # so that the deployment can be accessed from the outside | |
# apiVersion: v1 | |
# kind: Service | |
# metadata: | |
# name: linode-service | |
# labels: | |
# app: linode-app | |
# spec: | |
# type: LoadBalancer | |
# selector: | |
# app: linode-app | |
# ports: | |
# - protocol: TCP | |
# name: http | |
# port: 80 | |
# targetPort: 3300 | |
--- | |
# This section will create a service in the Kubernetes cluster | |
# Redis Service | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: redis | |
labels: | |
app: redis | |
spec: | |
ports: | |
- port: 6379 | |
name: redis | |
selector: | |
app: redis | |
--- | |
# This section will create a service in the Kubernetes cluster | |
# Redis Service | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: linode-app | |
spec: | |
type: ClusterIP | |
ports: | |
- port: 80 | |
targetPort: 3300 | |
selector: | |
app: linode-app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment