localstack k8s deployment yaml and health check endpoint

5/30/2021

I've set up win 10, minikube, docker. I need to start localstack in my local minikube. I didn't find out k8s deployment yaml. So I take docker compose yaml that provided by them at github. And create file like below:

# disk volume claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    com.job.service: localstack-claim0
  name: localstack-claim0
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
---
# service account
apiVersion: v1
kind: ServiceAccount
metadata:
  name: localstack-account
  labels:
    com.job.service: localstack-service-account
---
# service
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    com.job.service: localstack-service
  name: localstack-service
spec:
  type: NodePort
  externalTrafficPolicy: Cluster
  ports:
    - name: "edge"
      port: 4566
      targetPort: 4566
    - name: "es"
      port: 4571
      targetPort: 4571
    - name: "ui"
      port: 8080
      targetPort: 8080
  selector:
    com.job.service: localstack-service
status:
  loadBalancer: {}
---
# deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    com.job.service: localstack-deployment
  name: localstack-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      com.job.service: localstack-deployment
  strategy:
    type: Recreate
  template:
    metadata:
      creationTimestamp: null
      labels:
        com.job.service: localstack-deployment
    spec:
      containers:
        - env:
            - name: DATA_DIR
              value: ' '
            - name: DEBUG
              value: ' '
            - name: DOCKER_HOST
              value: tcp://127.0.0.1:2376
            - name: HOST_TMP_FOLDER
            - name: KINESIS_ERROR_PROBABILITY
              value: ' '
            - name: LAMBDA_EXECUTOR
              value: ' '
            - name: PORT_WEB_UI
              value: ' '
            - name: SERVICES
              value: 'sqs'
          image: localstack/localstack
          imagePullPolicy: IfNotPresent
          name: localstack-main
          ports:
            - name: edge
              containerPort: 4566
              protocol: TCP
            - name: es
              containerPort: 4571
              protocol: TCP
            - name: ui
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 0
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
            httpGet:
              path: /health
              port: edge
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 0
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
            httpGet:
              path: /health
              port: edge
          resources: {}
          volumeMounts:
            - mountPath: /tmp/localstack
              name: localstack-claim0
      restartPolicy: Always
      serviceAccountName: localstack-account
      volumes:
        - name: localstack-claim0
          persistentVolumeClaim:
            claimName: localstack-claim0
status: {}

but when I start with kubectl apply -f path_To_yaml and wait until all services is started. I try to reach health check endpoint and I receive only exception that cannot connect to host

I try to use minikube tunnel , and this didn't help

May be some1 know how to configure right localy? I am novice in devops

try to use minikube addons enable ingress but didn't help me

enter image description here

enter image description here

enter image description here

enter image description here

try to manual expose and forward port with next command

kubectl expose pod localstack-deployment-7667b8d6bf-6mqbp --type=ClusterIP --name=localstack

and

kubectl port-forward po/localstack-deployment-7667b8d6bf-6mqbp 4566:4566

and connect with aws cli and awslocal cli; But the same result: could not connect

-- faceoff
kubernetes
localstack
minikube

1 Answer

5/30/2021

Kubernetes clusters need to have an ingress controller for routing traffic from external world into

minikube addons enable ingress

The above will enable ingress and you should see a valid ingress controller when you do a 'get pods

NAME                                        READY     STATUS    RESTARTS   AGE
default-http-backend-59868b7dd6-xb8tq       1/1       Running   0          1m
kube-addon-manager-minikube                 1/1       Running   0          3m
kube-dns-6dcb57bcc8-n4xd4                   3/3       Running   0          2m
kubernetes-dashboard-5498ccf677-b8p5h       1/1       Running   0          2m
nginx-ingress-controller-5984b97644-rnkrg   1/1       Running   0          1m
storage-provisioner                         1/1       Running   0          2m

If this still does not solve your issue , please post additional information on below kubectl commands

kubectl describe ingress
kubectl describe service

The output of these commands might help assist you further

-- Sanjay
Source: StackOverflow