Kubernetes – connect to cassandra pod from helm hook pod

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

When I’m trying to execute the following command [“/bin/sh”, “-c”, “cqlsh cassandra.my-namespace.svc.cluster.local -f /path/to/schema.cql”] from my Job, I am receiving the following error: Traceback (most recent call last): File “/usr/bin/cqlsh.py”, line 2443, in <module> main(*read_options(sys.argv[1:], os.environ)) File “/usr/bin/cqlsh.py”, line 2421, in main encoding=options.encoding) File “/usr/bin/cqlsh.py”, line 485, in __init__ load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]), File “/usr/share/cassandra/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/policies.py”, line 417, in __init__ socket.gaierror: [Errno -2] Name or service not known My Job is defined as Helm Hook with post-install annotation. My Cassandra Pod is defined using StatefulSet. ind: StatefulSet metadata: name: cassandra spec: serviceName: cassandra replicas: 1 template: metadata: labels: app: cassandra spec: containers: – name: cassandra image: cassandra:3 imagePullPolicy: IfNotPresent ports: – containerPort: 7000 name: intra-node – containerPort: 7001 name: tls-intra-node – containerPort: 7199 name: jmx – containerPort: 9042 name: cql env: – name: CASSANDRA_SEEDS value: cassandra-0.cassandra.default.svc.cluster.local – name: MAX_HEAP_SIZE value: 256M – name: HEAP_NEWSIZE value: 100M – name: CASSANDRA_CLUSTER_NAME value: “Cassandra” – name: CASSANDRA_DC value: “DC1” – name: CASSANDRA_RACK value: “Rack1” – name: CASSANDRA_ENDPOINT_SNITCH value: GossipingPropertyFileSnitch volumeMounts: – name: cassandra-data mountPath: /var/lib/cassandra/data volumeClaimTemplates: – metadata: name: cassandra-data annotations: # comment line if you want to use a StorageClass # or specify which StorageClass volume.beta.kubernetes.io/storage-class: “” # comment line if you # want to use a StorageClass or specify which StorageClass spec: accessModes: [“ReadWriteOnce”] resources: requests: storage: 1Gi And this is my Service: kind: Service metadata: labels: app: cassandra name: cassandra spec: clusterIP: None ports: – port: 9042 selector app: cassandra When I run the cqlsh command manually from the container, everything works. Unfortunately, the automated solution throws the mentioned error. Am I missing something in the Service configuration? I have thought, since I’m connecting to service from the Pod created by Job, it should work. submitted by /u/Sihal [link] [comments]

X ITM Cloud News

Patricia

Leave a Reply

Next Post

Separate cluster for self-managed databases?

Thu Jul 30 , 2020
Spread the love          What are your thoughts on creating a separate cluster for multiple databases vs mixed cluster with stateful and stateless workloads? Does it makes sense to isolate databases from possibly resource noisy stateless resources? Some would argue that classic VMs for databases are better but wouldn’t it be foolish […]
X- ITM

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware

.

X ITM