Closed lethanhson9901 closed 9 months ago
I also debug:
https://127.0.0.1:6443/
. And ChatGPT hint that:The value for <KUBERNETES_API_SERVER_ENDPOINT>
in the kube-scheduler configuration depends on where your kube-scheduler is running in relation to the Kubernetes API server. Here are the typical scenarios:
127.0.0.1:6443
. This local loopback address assumes that the kube-scheduler and the API server are on the same node, and it will connect to the API server on the local machine.https://192.168.56.11:6443
. This ensures that the kube-scheduler can reach the API server over the network.In most Kubernetes setups, especially in production or multi-node environments, the kube-scheduler is not typically on the same machine as the API server. In such cases, you need to use the actual network address. However, in single-node setups or for certain testing scenarios, it might be on the same node, and using 127.0.0.1:6443
would be appropriate.
Which IP should I choose: 127.0.0.1 or INTERNAL_IP (like: 192.168.56.11).
# INTERNAL_IP=$(ip addr show enp0s8 | grep "inet " | awk '{print $2}' | cut -d / -f 1)
LOCAL_IP="127.0.0.1"
cat <<EOF | sudo tee /var/lib/kubernetes/kube-scheduler.kubeconfig
apiVersion: v1
clusters:
- cluster:
certificate-authority: /var/lib/kubernetes/pki/ca.crt
server: https://${LOCAL_IP}:6443
name: kubernetes-the-hard-way
contexts:
- context:
cluster: kubernetes-the-hard-way
user: system:kube-scheduler
name: default
current-context: default
kind: Config
preferences: {}
users:
- name: system:kube-scheduler
user:
client-certificate: /var/lib/kubernetes/pki/kube-scheduler.crt
client-key: /var/lib/kubernetes/pki/kube-scheduler.key
EOF
In this lab the scheduler is running on the same host as the API server. The kube-scheduler.kubeconfig
is created in step 5 and will use 127.0.0.1:6443
.
I also check kube-scheduler.kubeconfig file, which was generated in lab05, but I dont know how to fix that bug:
From what you pasted below that comment, it looks like you did not run the following during lab05
kubectl config set-cluster kubernetes-the-hard-way \
--certificate-authority=/var/lib/kubernetes/pki/ca.crt \
--server=https://127.0.0.1:6443 \
--kubeconfig=kube-scheduler.kubeconfig
Please
I've solved this, thank you so much !
Your Workstation
Ubuntu, 16 GB RAM, 8 core i7 CPU
What happened?
I followed your instruction file. But when the last check command:
./cert_verify.sh
. I got this output:I also check
kube-scheduler.kubeconfig
file, which was generated in lab05, but I dont know how to fix that bug:Please help me, thanks!
Relevant log output
No response