How to get de pods on a running state

8/30/2019

I'm trying to set up Cassandra on a Kubernetes cluster made of three virtual machines using two different files (Deployment and Service). In order to do this I use the command

kubectl create -f file.yaml

The service file works perfectly but when I start the other one with three replicas, the state of the pods is CrashLoopBackOff instead of running.

The configuration of the deployment file is the following

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: cassandra
  labels:
    app: cassandra
spec:
  replicas: 3
  selector:
    matchLabels:
      app: cassandra
  template:
    metadata:
      labels:
        app: cassandra
    spec:
      containers:
      - name: cassandra
        image: gcr.io/google_containers/cassandra:v5
        ports:
        - containerPort: 9042

And this is the service file

apiVersion: v1
kind: Service
metadata:
  labels:
    app: cassandra
  name: cassandra
spec:
  type: NodePort
  ports:
    - port: 9042
  selector:
    app: cassandra

I appreciate any help on this.

-- Paloma Gómez
cassandra
kubernetes

1 Answer

8/30/2019

You shouldnt be using Deployment for running stateful applications. StatefulSets are recommended for running databases like cassandra.

follow the below link for reference --> https://kubernetes.io/docs/tutorials/stateful-application/cassandra/

-- P Ekambaram
Source: StackOverflow