diff --git a/Makefile b/Makefile index e0081f58f30..ce57fc8d6dd 100644 --- a/Makefile +++ b/Makefile @@ -189,6 +189,16 @@ portmap: @echo curl -L $(FETCH_URL) | tar -z -x ./portmap +debug-script: FETCH_URL=https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-log-collector.sh +debug-script: VISIT_URL=https://github.com/awslabs/amazon-eks-ami/tree/master/log-collector-script/linux +debug-script: + @echo "Fetching debug script from awslabs/amazon-eks-ami" + @echo + @echo "Visit upstream project for debug script details:" + @echo "$(VISIT_URL)" + @echo + curl -L $(FETCH_URL) -o ./aws-cni-support.sh + # Run all source code checks. check: check-format lint vet diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index a3e430e436c..80f56971bb7 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -71,11 +71,10 @@ ipamd.log.2018-05-16-01 ipamd.log.2018-05-16-06 ipamd.log.2018-05-16-11 ipamd ### collecting node level tech-support bundle for offline troubleshooting ``` -[root@ip-192-168-188-7 aws-routed-eni]# /opt/cni/bin/aws-cni-support.sh +[root@ip-192-168-188-7 aws-routed-eni]# /opt/cni/bin/aws-cni-support.sh // download -/var/log/aws-routed-eni/aws-cni-support.tar.gz - +/var/log/eks_i-01111ad54b6cfaa19_2020-03-11_0103-UTC_0.6.0.tar.gz ``` ### ipamD debugging commands diff --git a/scripts/aws-cni-support.sh b/scripts/aws-cni-support.sh deleted file mode 100755 index 2014054cada..00000000000 --- a/scripts/aws-cni-support.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash -# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"). You may -# not use this file except in compliance with the License. A copy of the -# License is located at -# -# http://aws.amazon.com/apache2.0/ -# -# or in the "license" file accompanying this file. This file is distributed -# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -# express or implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# This script generates a file in go with the license contents as a constant - -# Set language to C to make sorting consistent among different environments. -export LANG=C - -set -uo pipefail -LOG_DIR="/var/log/aws-routed-eni" -mkdir -p ${LOG_DIR} - -# Collecting L-IPAMD introspection data -curl http://localhost:61679/v1/enis > ${LOG_DIR}/eni.out -curl http://localhost:61679/v1/pods > ${LOG_DIR}/pod.out -curl http://localhost:61679/v1/networkutils-env-settings > ${LOG_DIR}/networkutils-env.out -curl http://localhost:61679/v1/ipamd-env-settings > ${LOG_DIR}/ipamd-env.out -curl http://localhost:61679/v1/eni-configs > ${LOG_DIR}/eni-configs.out - -# Metrics -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 -else - echo "======== Unable to find KUBECONFIG, IGNORING POD DATA =========" -fi - -# ifconfig -ifconfig > ${LOG_DIR}/ifconfig.out - -# ip rule show -ip rule show > ${LOG_DIR}/iprule.out - -# iptables-save -iptables-save > ${LOG_DIR}/iptables-save.out - -# iptables -w1 -nvL -iptables -w1 -nvL > ${LOG_DIR}/iptables.out - -# iptables -w1 -nvL -t nat -iptables -w1 -nvL -t nat > ${LOG_DIR}/iptables-nat.out - -# iptables -w1 -nvL -t mangle -iptables -w1 -nvL -t mangle > ${LOG_DIR}/iptables-mangle.out - -# dump cni config -mkdir -p ${LOG_DIR}/cni -cp /etc/cni/net.d/* ${LOG_DIR}/cni - -# collect kubelet log -cp /var/log/messages ${LOG_DIR}/ - -# dump out route table -ROUTE_OUTPUT=${LOG_DIR}/"route.out" -echo "=============================================" >> ${ROUTE_OUTPUT} -echo "ip route show table all" >> ${ROUTE_OUTPUT} -ip route show table all >> ${ROUTE_OUTPUT} - -# dump relevant sysctls -echo "================== sysctls ==================" > ${LOG_DIR}/sysctls.out -for f in /proc/sys/net/ipv4/conf/*/rp_filter; do - echo "$f = $(cat ${f})" >> ${LOG_DIR}/sysctls.out -done - -tar --exclude 'aws-cni-support.tar.gz' -cvzf ${LOG_DIR}/aws-cni-support.tar.gz ${LOG_DIR}/ diff --git a/scripts/dockerfiles/Dockerfile.release b/scripts/dockerfiles/Dockerfile.release index 06910a35d76..0631555832a 100644 --- a/scripts/dockerfiles/Dockerfile.release +++ b/scripts/dockerfiles/Dockerfile.release @@ -14,7 +14,7 @@ COPY go.mod go.sum ./ RUN go mod download COPY Makefile ./ -RUN make portmap +RUN make portmap && make debug-script COPY . ./ RUN make build-linux @@ -30,9 +30,9 @@ WORKDIR /app COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni \ /go/src/github.com/aws/amazon-vpc-cni-k8s/misc/10-aws.conflist \ /go/src/github.com/aws/amazon-vpc-cni-k8s/portmap \ + /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni-support.sh \ /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-k8s-agent \ /go/src/github.com/aws/amazon-vpc-cni-k8s/grpc-health-probe \ - /go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/aws-cni-support.sh \ /go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/entrypoint.sh /app/ ENTRYPOINT /app/entrypoint.sh