Skip to content

Instantly share code, notes, and snippets.

@joseabraham
Created February 21, 2023 19:05
Show Gist options
  • Save joseabraham/78d0203d4c8a102f4e8eb4e20cd98d01 to your computer and use it in GitHub Desktop.
Save joseabraham/78d0203d4c8a102f4e8eb4e20cd98d01 to your computer and use it in GitHub Desktop.

Revisions

  1. joseabraham created this gist Feb 21, 2023.
    130 changes: 130 additions & 0 deletions k8s.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,130 @@
    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