Error Debugging
Kubernetes Command Not Found
2024-11-22 06:00:02 - Script execution started.
/data/scripts/log_cleaner.sh: line 60: kubectl: command not found
2024-11-22 06:00:02 - No pods found matching the patterns in namespace prd-ns.
Solution:
which kubectl
Replace kubectl
command with absolute path of kubectl
from the command. It will be like this.
/usr/local/bin/kubectl
Connection Refused
E1125 06:00:02.151541 190966 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?
2024-11-25 06:00:02 - No pods found matching the patterns in namespace prd-ns.
Solution:
Describe Kubernetes IP and port on global environment variables. It will be like this.
export KUBECONFIG=~/.kube/config
export KUBERNETES_SERVICE_HOST=192.168.1.10
export KUBERNETES_SERVICE_PORT=443