Skip to content

Commit

Permalink
Update kubeconfig lookup with eksctl clusters
Browse files Browse the repository at this point in the history
During eksctl bootstrap, the `/etc/systemd/system/kubelet.service` file still exists, although `kubelet.service.d/10-eksclt.al2.conf` and `/etc/eksctl/kubeconfig.yaml` are created and used.

This causes errors when running the `aws-cni-support.sh` script due to the precedence of looking up the kubeconfig file.

`error: unable to read certificate-authority /etc/kubernetes/pki/ca.crt for kubernetes due to open /etc/kubernetes/pki/ca.crt: no such file or directory`
  • Loading branch information
dkeightley authored and mogren committed Jun 25, 2019
1 parent 543b7e9 commit 723dd5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/aws-cni-support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ curl http://localhost:61678/metrics 2>&1 > ${LOG_DIR}/metrics.out
# Collecting kubelet introspection data
if [[ -n "${KUBECONFIG:-}" ]]; then
command -v kubectl > /dev/null && kubectl get --kubeconfig=${KUBECONFIG} --raw=/api/v1/pods > ${LOG_DIR}/kubelet.out
elif [[ -f /etc/eksctl/kubeconfig.yaml ]]; then
command -v kubectl > /dev/null && kubectl get --kubeconfig=/etc/eksctl/kubeconfig.yaml --raw=/api/v1/pods > ${LOG_DIR}/kubelet.out
elif [[ -f /etc/systemd/system/kubelet.service ]]; then
KUBECONFIG=`grep kubeconfig /etc/systemd/system/kubelet.service | awk '{print $2}'`
command -v kubectl > /dev/null && kubectl get --kubeconfig=${KUBECONFIG} --raw=/api/v1/pods > ${LOG_DIR}/kubelet.out
elif [[ -f /etc/eksctl/kubeconfig.yaml ]]; then
command -v kubectl > /dev/null && kubectl get --kubeconfig=/etc/eksctl/kubeconfig.yaml --raw=/api/v1/pods > ${LOG_DIR}/kubelet.out
else
echo "======== Unable to find KUBECONFIG, IGNORING POD DATA ========="
fi
Expand Down

0 comments on commit 723dd5a

Please sign in to comment.