When trying to use kubectl proxy it says "Starting to serve on 127.0.0.1:8001" but when I try to actually access the URL it does not load at all, giving a timeout as if I tried to access a random non-existing website (Connecting not established).
I was having issues with the metrics addon not being able to run "kubectl top nodes" and show the info of all nodes but after adding "hostName: true" to the .yaml file for the metrics server it is now working. (View YAML files folder for changelog & detail of where the line was added).
But 'kubectl proxy' still does nothing and I am out of ideas of where to search for the error.
Here are the logs after a full deployment:
kubectl get services --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 9m18s
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 9m16s
kube-system metrics-server ClusterIP 10.103.56.197 <none> 443/TCP 9m11s
kubernetes-dashboard dashboard-metrics-scraper ClusterIP 10.108.168.26 <none> 8000/TCP 9m9s
kubernetes-dashboard kubernetes-dashboard ClusterIP 10.98.162.247 <none> 443/TCP 9m9s
kubectl get nodes
NAME STATUS ROLES AGE VERSION
master-node Ready control-plane,master 9m10s v1.23.6
worker-node01 Ready worker 6m33s v1.23.6
worker-node02 Ready worker 4m12s v1.23.6
kubectl get all -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
pod/dashboard-metrics-scraper-799d786dbf-pvbtq 1/1 Running 0 13m
pod/kubernetes-dashboard-fb8648fd9-mkg6m 1/1 Running 0 13m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/dashboard-metrics-scraper ClusterIP 10.108.168.26 <none> 8000/TCP 13m
service/kubernetes-dashboard ClusterIP 10.98.162.247 <none> 443/TCP 13m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/dashboard-metrics-scraper 1/1 1 1 13m
deployment.apps/kubernetes-dashboard 1/1 1 1 13m
NAME DESIRED CURRENT READY AGE
replicaset.apps/dashboard-metrics-scraper-799d786dbf 1 1 1 13m
replicaset.apps/kubernetes-dashboard-fb8648fd9 1 1 1 13m
kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://10.0.0.10:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
To deploy the dashboard we are using (available aswell on the master.sh script):
# Install Kubernetes Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.1/aio/deploy/recommended.yaml
# Create Dashboard User
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
EOF
cat <<EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
EOF
kubectl -n kubernetes-dashboard get secret "$(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}")" -o go-template="{{.data.token | base64decode}}" >> /vagrant/configs/token
sudo -i -u vagrant bash << EOF
whoami
mkdir -p /home/vagrant/.kube
sudo cp -i /vagrant/configs/config /home/vagrant/.kube/
sudo chown 1000:1000 /home/vagrant/.kube/config
EOF
If I try to deploy a sample nginx deployment using:
kubectl apply -f https://raw.githubusercontent.com/AlexPaiva/Portal-for-Service-Mesh-for-Virtualized-Environments/main/Deployment/yaml/sample-app.yaml
It is fully accessible by then visiting the URL "http://10.0.0.10:32000/", which returns:
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to [nginx.org](http://nginx.org/).
Commercial support is available at [nginx.com](http://nginx.com/).
Thank you for using nginx.