POD start only 1 container

164 views Asked by At

Hi I don't know whether this is an issue that I am having since I don't have a lot of experience in Kubernetes.

I am trying a deployment in Kubernetes but the logic behind the container it is that it start initialising it self instantly and calling a backend endpoint to register a user.

From the screenshot below I don't know whether this is an misconfiguration about my deployment but I think that the POD starts multiple containers and this breaks my deployment since the flow goes like this:

  1. Container starts
  2. Calls backend endpoint and register user
  3. Kubernetes starts another container
  4. Calls backend endpoint and fails to register user because its already been registered
  5. POD fails to deploy

Screenshot

As you can see in the screenshot the container count is 5

Adding as well the deployment yaml file

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vulos-hyperledger-scanner
  namespace: vuloss-scanner
spec:
  replicas: 1
  selector:
    matchLabels:
      app: vulos-hyperledger-scanner
  template:
    metadata:
      labels:
        app: vulos-hyperledger-scanner
    spec:
      containers:
        - name: vulos-hyperledger-scanner
          image: registry.digitalocean.com/notarised/vulos-hyperledger-scanner:1.6.5
          ports:
            - containerPort: 8080
          env:
          imagePullPolicy: Always
      imagePullSecrets:
        - name: do-registry

---
apiVersion: v1
kind: Service
metadata:
  name: vulos-hyperledger-scanner
  namespace: vuloss-scanner
spec:
  selector:
    app: vulos-hyperledger-scanner
  ports:
    - port: 80
      targetPort: 8080
  type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: "letsencrypt-production"
  name: vulos-hyperledger-scanner
  namespace: vuloss-scanner
spec:
  rules:
    - host: explorer.vulos.io
      http:
        paths:
          - backend:
              serviceName: vulos-hyperledger-scanner
              servicePort: 80
            path: /
  #This section is only required if TLS is to be enabled for the Ingress
  tls:
    - hosts:
        - explorer.vulos.io
      secretName: explorer-tls

I don't know whether this is an issue in my deployment and whether this statement of above makes sense in Kubernetes and whether I can make the POD to start only 1 container rather than multiple

Thank you

0

There are 0 answers