I trying to setup drone on kubernetes runner.
I found a document that Kubernetes runner required to specify a port in yaml file.
http://discuss.harness.io/t/drone-on-k8s-services-arent-accessable-at-there-hostname/3511
Strangely, if hostname contains an underscore, the service cannot be accessed from the pipeline step.
When I was delete underscore on service name, It works properly.
Here is the example.
kind: pipeline
type: kubernetes
name: default
services:
- name: db_db
image: mysql:5.7
environment:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: test
ports:
- 3306
steps:
- name: ping-mysql
image: mysql:5.7
environment:
DATABASE_HOSTNAME: db_db
DATABASE_USERNAME: root
DATABASE_PASSWORD: test
commands:
# wait for mysql service to become available
- |
export RETRY_COUNT=10
count=0
until ( mysqladmin -u$DATABASE_USERNAME -p$DATABASE_PASSWORD -h$DATABASE_HOSTNAME ping --connect_timeout=2 )
do
count=$((count+1))
if [ $count -gt $RETRY_COUNT ]
then
echo "Failed to start required services."
exit 1
fi
echo "Checking the services(retry = $count)"
sleep 10
done
step ping-mysql output:
mysqladmin: connect to server at 'db_db' failed
error: 'Unknown MySQL server host 'db_db' (0)'
Check that mysqld is running on db_db and that the port is 3306.
You can check this by doing 'telnet db_db 3306'
Checking the services(retry = 1)
I am using kubernetes with kops on AWS.
The kubernetes version was v1.14.8
Drone server Image: docker.io/drone/drone:1.6.1