i can't connect redis with phpfpm in kubernetes - laravel

I am trying to connect redis with phpfpm in kubernetes but I can`t, it shows the connection timeout as you shown in the picture

Related

Tcp client not connecting to server when using istio

I created two sample application(tcp-server and tcp-client) for checking TCP connection in istio environment. Used the below link to create server and client in g0
https://www.linode.com/docs/guides/developing-udp-and-tcp-clients-and-servers-in-go/
Deployed the application in kubernetes cluster and tested without istio, it is working fine.
But after installing istio(demo configuration, followed this url to install istio: https://istio.io/latest/docs/setup/getting-started/),
and redeploying the apps to fill with envoy-proxy, the client is not connecting to server
Also using below command makes the server connect success
sh -c "echo world | nc 10.244.1.29 1234" is
What am I doing wrong?
Posting the solution I found.
Issue: I was trying to connect to server using ip address and nodePort, which some how not working in istio environment
Solution: From Client instead of providing ip address and nodePort of server node, give service name and container port of server app.
Extra Info: For using client from outside cluster, create gateway and virtual service for server. In your external client provide nodePort and ip address of istio-ingress pod as server destination

How to connect Jaeger to secured Elasticsearch

My Elasticsearch cluster is secured with HTTPS and Basic Auth. I'd like to connect jaeger-ingester and jaeger-query on it.
I tried setting:
es.server-urls=https://elasticsearch:9200
es.tls.enabled=true
es.username=jaeger
es.password=XXXX
But I get:
{"level":"fatal","ts":1626344336.0828998,"caller":"command-line-arguments/main.go:65","msg":"Failed to init storage factory","error":"failed to create primary Elasticsearch client: health check timeout: no Elasticsearch node available","stacktrace":"main.main.func1\n\tcommand-line-arguments/main.go:65\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra#v0.0.7/command.go:838\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra#v0.0.7/command.go:943\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra#v0.0.7/command.go:883\nmain.main\n\tcommand-line-arguments/main.go:114\nruntime.main\n\truntime/proc.go:225"}
This error message is not helpful.
How can I debug storage connection initialisation?

Connect to Consul server running openshift to consul client running on localhost

When I run consul on my local machine and spring boot client with following properties in bootstrap.properties, I can see that it connects, discovers services and able to connect from one service to other using service discovery.
Bootstrap.properties:
spring.cloud.consul.host=localhost
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.instance-id=consul-service2
spring.application.name=consul-service2
server.port=8083
But now, I installed consul on openshift provided route to it. I can browse to consul UI and see that consul service has registered itself. But when I try to connect client running on localhost to consul running on openshift i get error.
com.ecwid.consul.transport.TransportException: org.apache.http.conn.ConnectTimeoutException: Connect to consul-uservices-template.f-az.uk.paas.intranet.db.com:8500 [consul-uservices-template.hju-azh.uk.paas.intranet.sdf.com/10.248.36.85] failed: connect timed out
at com.ecwid.consul.transport.AbstractHttpTransport.executeRequest(AbstractHttpTransport.java:77) ~[consul-api-1.4.1.jar:na]
at com.ecwid.consul.transport.AbstractHttpTransport.makePutRequest(AbstractHttpTransport.java:41) ~[consul-api-1.4.1.jar:na]
at com.ecwid.consul.v1.ConsulRawClient.makePutRequest(ConsulRawClient.java:135) ~[consul-api-1.4.1.jar:na]
at com.ecwid.consul.v1.agent.AgentConsulClient.agentServiceRegister(AgentConsulClient.java:273) ~[consul-api-1.4.1.jar:na]
at com.ecwid.consul.v1.ConsulClient.agentServiceRegister(ConsulClient.java:309) ~[consul-api-1.4.1.jar:na]
My bootstrap.properties:
spring.cloud.consul.host=consul-uservices-template.hju-azh.uk.paas.intranet.sdf.com
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.instance-id consul-service2
spring.application.name=consul-service2
server.port=8083
What i am doing is providing route path as host, am I wrong here ? I can see that it tries to connect to consul-uservices-template.hju-azh.uk.paas.intranet.sdf.com:8500 and it times out. I get 404 even on browser when i try to hit this url. It should not be accessing with port number. How can i do that ?
It should not be accessing with port number.
As the route is provided via OpenShift (and you can access it the web UI too), I assume it is accessible through port 80.
If that is the case, you can specify spring boot to access consul via port 80 by change the following properties
spring.cloud.consul.port=80

Kubernetes and Prometheus not working together with Grafana

I have created a kubernetes cluster on my local machine with one master and at the moment zero workers, using kubeadm as the bootstrap tool. I am trying to get Prometheus (from the helm packet manager) and Kuberntes matrics together to the Grafana Kubernetes App, but this is not the case. The way I am setting up the monitoring is:
Open grafana-server at port 3000 and install the kuberntes app.
Install stable/prometheus from helm and using this custom YAML file I found in another guide.
Adding Prometheus data source to Grafana with IP from kubernetes Prometheus service (or pods, tried both and both works well) and use TLS Client Auth.
Starting proxy port with kubectl proxy
Filling in all information needed in the Kubernetes Grafana app and then deploy it. No errors.
All kubernetes metric shows, but no Prometheus metric.
If kubernetes proxy connection is stopped, Prometheus metric can be seen. There are no problems connecting to the Prometheus pod or service IP when kubernetes proxy is running. Does someone have any clue what I am doing wrong?

Connecting to redis cluster with sentinel on kubernetes

I've successfully set up a password-protected redis cluster using the guide here:
http://kubernetes.io/v1.1/examples/redis/
I can connect to the sentinel just fine using redis-cli, but I cannot connect to the redis master/slave even though I have exposed the sentinels.
I'm using ruby and the following connection string.. Am I doing this wrong?
SENTINELS = [{host: "104.122.24.897", port: 26379}]
redis = Redis.new(url: "redis://mymaster", sentinels: SENTINELS, :role => :master, password: "longasspassword", timeout: 16)
The error I get is:
Error connecting to Redis on 10.64.7.33:6379 (Redis::TimeoutError) (Redis::CannotConnectError)`
I eventually settled on using helm (https://helm.sh/) and installed redis-cluster using helm install redis-cluster.
I can connect to the redis cluster using the cluster_ip (not external ip) in kubernetes and this satisfies my security requirement. redis sentinel works out of the box with this approach.

Resources