I'm using Kubernetes Continuous Deploy Plugin to deploy and I'm using pipeline and this is stage to deploy into kubernetes in the Jenkinsfile:
stage('Deploy to k8s'){
steps{
kubernetesDeploy(
configs:'quarkusAgrata.yaml',
kubeconfigId:'KUBERNETES_CLUSTER_CONFIG',
enableConfigSubstitution:true
)
}
}
I am getting these errors even after correctly configuring
My KUBERNETES_CLUSTER_CONFIG image
Log on to the box/container/pod hosting Jenkins and try to ping the IP, if alls good, try to telnet to the IP AND port. Depending on the results you should know whether or not a connection is possible from your Jenkins host. Note: if you have Jenkins running in a Container On a pod, you may need to ssh into the container on the pod. Make sure you're in the correct environment when trying to debug. Otherwise you'll kid yourself into thinking you're forming a connection from the Jenkins host when you might not be at quite the right level.
ping 123.123.123.123 - show whether a connection to the host is possible on the ping port.
telnet 123.123.123.123 8080 - connecting to a specific port via telnet - if all is good the connection should be opened. If you don't have the telnet application on the pod you may need to install it.. or else you can spin up a busybox container which has various tools alongside telnet for debugging.
Related
I'm using Jenkins on Docker on my local Mac Machine.
And I'm running another Docker on ubuntu VirtualBox. So now, there are 2 docker machines. one is on my mac machine and one is on my Ubuntu VirtualBox machine. I'm running Jenkins on Mac Docker. Now in the Jenkins pipeline, I want to build an image on my ubuntu machine.
I've configured Jenkins docker cloud and in the docker host URL, it is connected to the ubuntu docker-machine.
But while building a new image, I'm getting the error. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I've tried even adding ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock
at /lib/systemd/system/docker.service
WHen i check ps -aux,
Can someone please help me out?
help is appreciated.
First personally if I had a setup like that I would not bother connecting to the remote docker and would just install a Jenkins agent on the ubuntu machine and make it talk to the Jenkins master.
But if you want to do it they way you have it set up right now we a Jenkins talking from inside out one docker host into another docker host I suggest looking into the following:
Your Jenkins master and the ubuntu machine a very isolated they might as well just be on different machines not even in the same room. Unix domain sockets, the ones that are identified by unix://* are made for communicating within a single local OS kernel, trying to bridge them into remote machine will lead to disaster.
So the only way Jenkins could communicate to the remote host is via a remote protocol like TCP. Most of the time when you install docker with the default settings it doesn't even listen to TCP at all, mostly for security reasons.
First thing you should do is to configure a docker inside of the ubuntu machine to listen on TCP port and accept connections from remote hosts. You can use netstat -nat to see if anything is listening on TCP 4243. When things are configured correctly you see the line that stats with 0.0.0.0:4243 or something like that in the output of the nestat
Second you need to make sure your the firewalls/iptables/netfilter configuration on the Ubuntu host lets in connections from outside. A good test to try is to telnet <ubuntu-ip> 4243 from a terminal session on your Mac.
Then you need to make sure you that docker networking is configured correctly so that connections from the inside of the container that is running Jenkins end up on your ubuntu box. To test you need to exec -it into your jenkins container and repeat the telnet test. On modern linuxes telnet is usually not installed, so you can use curl -vvv which will always end up with an error, so just look at the verbose output to see if the error because things cannot communicate (timeout, connection reset etc) or the error occurs because your curl tried to talk HTTP to docker and got gibberish response. In the later case you can consider things to be set up correctly.
Finally you need to tell Jenkins Docker to communicate to the remote docker via TCP. Usually that is given on the command line to your docker run, docker ps, docker exec
I've configured it by defining the slave label in my Jenkins Pipeline.
Jenkins agents run on a variety of different environments such as physical machines, virtual machines, Kubernetes clusters, and Docker images.
In your Jenkins Pipeline or In your JenkinsFile, you've to set the agent accordingly to what you're using either using Docker image or any virtual machine.
Also Thank you so much #Vlad, all the things you told me, were really helpful.
I have JMeter Master (5.3) running in a Docker container, triggered by a Jenkins pipeline containing a 'docker run' command. It communicates to JMeter slaves that are located in a Kubernetes namespace, with an Ingress controller to handle input. (For this trial I'm using just one slave but there may be multiple in the future)
The Docker JMeter Master container is aware of Ingress and can reference it by name or by IP address. From within the JMeter Master container I am able to ping the JMeter slave hostname and it is giving the Ingress IP address which I would expect.
Ingress in turn has the ability to communicate with the JMeter slave, but I can't get from JMeter Master to JMeter slave. I have set server.rmi.localport=80 on both sides, the JMeter slave seems to register port 80 in the logs.
The error from the JMeter Master is 'operation timed out (connection timed out)'. I'm not sure where to start looking?
(For reference, we cannot move JMeter Master into Kubernetes, but conversely the slaves need to stay in Kubernetes in order to provide the workload).
Edit: I've done some more investigation. The problem seems to occur that while the base RMI port is port 80, it's also trying to open port 81 and port 82. This will obviously fail as I've only got port 80 available through ingress.
So the question is now 'how do I tell JMeter to only use a single port for RMI'?
As an update to this, basically I've come to the conclusion that 'you can't do this'. While the ports can be opened on Ingress, RMI can't communicate over them. So even if I could get it all on one port, it still wouldn't work.
There is a 'RMI over HTTP' implementation but I wouldn't have first idea on how to put that into JMeter.
What I have done is add a small webserver to the pod, such that I can control JMeter through normal web calls. For example, the jmx file can be PUT on to the pod, and a GET command can retrieve the results. That way I can start the pod up in the relevant location, where it will wait for whatever tests we want to run. It's also extendable if I need additional functionality.
I want to integrate my Jira, Jenkins, and confluence. I have configured all the software with the help of a docker image. i.e., Jenkins -- Port 8082, Jira -- Port 8081, confluence -- Port 8090.
For Jira – Jenkins Integration, I used "Jira Issue Updater," but Jenkins console is troughing an error –
Unable to connect to REST service
java.net.ConnectException: Connection refused (Connection refused)Finished: SUCCESS
My fundamental question — Is it possible to connect two docker images because, by default, Jenkins and Jira's opening port are 8080. Still, I configured it as per my convenience (All docker images are in one docker network, and I could able to ping Jira's IP from Jenkins instance means Jira is reachable to Jenkins).
I am a bit confused about this integration. I need some support from community members.
I have a docker image on the google cloud platform that I would like to run. Part of this script attempts to connect to a RabbitMQ server (located in the same subnet). This does not work.
I've taken the following steps to try and solve it:
I have tried connecting to both the internal and external IP-address of the RabbitMQ server.
I have enabled VPC-native (alias IP)
I have checked I can connect to the internet from my docker image
I have checked that my docker image can connect to RabbitMQ when run locally
I have checked that the server can connect to the internal IP-address from the RabbitMQ server (by pinging it)
I think I probably have an incorrect setting in my kubernetes engine, but I've looked for quite some time and I cannot find it.
Does anybody know how to connect to a RabbitMQ server from a Kubernetes pod running in the Google Cloud Platform?
We have a couple docker containers deployed on ECS. The application inside the container uses remote service, so it needs to access them using their 10.X.X.X private IPs.
We are using Docker 1.13 with CentOS 7 and docker/alpine as our base image. We are also using netwokMode: host for our containers. The problem comes when we can successfully run telnet 10.X.X.X 9999 from the host machine but if we run the same command from inside the container, it just hangs and it's not able to connect.
In addition, we have net.ipv4.ip_forward enabled in the host machines (where the container runs) but disabled in the remote machine.
Not sure what could be the issue, maybe iptables?
I have spent the day with the same problem (tried with both network mode 'bridge' and 'host'), and it looks like an issue with using busybox's telnet inside ECS - Alpine's telnet is a symlink to busybox. I don't know enough about busybox/networking to suggest what the root cause is, but I was able to prove the network path was clear by using other tools.
My 'go to' for testing a network path is using netcat as follows. The 'success' or 'failure' message varies from version to version, but a refusal or a timeout (-w#) is pretty obvious. All netcat does here is request a socket - it doesn't actually talk to the listening application, so you need something else to test that.
nc -vz -w2 HOST PORT
My problem today was troubleshooting an app's mongo connection. nc showed the path was clear, but telnet had the same issue as you reported. I ended up installing the mongo client and checking with that, and I could connect properly.
If you need to actually run commands over telnet from inside your ECS container, perhaps try installing a different telnet tool and avoiding the busybox inbuilt one.