kind: [connection]: Unable to access kind cluster inside a custom Github Action
What is happening?
- I’m Using a KinD cluster in Github Action the flow of workflow yaml is:
- Creating KinD cluster (Created successfully)
- Getting Nodes via
kubectl get nodes
NAME STATUS ROLES AGE VERSION
kind-control-plane Ready master 68s v1.17.0
- Now I’m trying to use the cluster inside my personal Github action bypassing kubeconfig. It is showing connection error:
exit status 1: The connection to the server 127.0.0.1:32768 was refused - did you specify the right host or port?
- Did I need to do anything else?
Workflow-yaml
name: Push
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Creating KinD cluster
run: |
GO111MODULE=on
curl -Lo ./kind https://github.com/kubernetes sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version
kind create cluster --loglevel debug
sleep 60
- name: Getting Nodes
run: |
kubectl get nodes
- name: Set config
run: echo ::set-env name=KUBE_CONFIG_DATA::$(base64 -w 0 ~/.kube/config)
#This is the custom Github Action inside which the kubectl command is not running.
- name: Running Litmus pod delete chaos experiment
uses: uditgaurav/kubernetes-chaos@v0.1.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (12 by maintainers)
Taking a second look: does this last action run in a container?
Localhost / the loopback interface is unique to each container. 127.0.0.1 is local to each container…
You can use kind export kubeconfig --internal on 0.7, on 0.8+ you’d either need this step to run on the kind network somehow (not sure if this is possible with GitHub actions), or else maybe https://github.com/kubernetes-sigs/kind/issues/1558
Github Actions Ubuntu images come pre-installed with kind. You can find it out here or send a pr if you want to update it. https://github.com/actions/virtual-environments/search?q=kind&unscoped_q=kind
If you want a specific version of kind, use https://github.com/engineerd/setup-kind wihtout any issues. This works flawlessly.
like, basically this is just docker networking, kind can’t do anything here. if you run containers on a different network and don’t connect them docker intentionally isolates them. you can connect them either by changing the container network when creating it or using
docker network connect ...
the loopback address is only reachable from host networking because linux.
awesome thanks!
I’d like to figure out 0.8+, but we can revisit that later 😃
I forgot we only have “kind get kubeconfig --internal >$HOME/.kube/config”
This may be an issue on 0.8+ … I’m not sure if github exposes what docker network they use for actions or any way to configure it. it looks like no and no.
On Wed, May 27, 2020 at 1:53 PM UDIT GAURAV notifications@github.com wrote: