I installed kubernetes and it all looks alright I think. ( note that those are outputs after editing a file below, changing to NodePort)
sudo kubectl get deployment kubernetes-dashboard -n kubernetes-dashboard
NAME READY UP-TO-DATE AVAILABLE AGE
kubernetes-dashboard 1/1 1 1 85m
and
sudo kubectl describe service kubernetes-dashboard -n kubernetes-dashboard
Name: kubernetes-dashboard
Namespace: kubernetes-dashboard
Labels: k8s-app=kubernetes-dashboard
Annotations: <none>
Selector: k8s-app=kubernetes-dashboard
Type: NodePort
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.102.39.197
IPs: 10.102.39.197
Port: <unset> 443/TCP
TargetPort: 8443/TCP
NodePort: <unset> 30306/TCP
Endpoints: 10.244.0.4:8443
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Type 45m service-controller NodePort -> LoadBalancer
Normal Type 16m service-controller LoadBalancer -> NodePort
and
sudo kubectl get all -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
pod/dashboard-metrics-scraper-856586f554-5bps6 1/1 Running 0 69m
pod/kubernetes-dashboard-67484c44f6-dtc27 1/1 Running 0 69m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/dashboard-metrics-scraper ClusterIP 10.107.30.72 <none> 8000/TCP 69m
service/kubernetes-dashboard NodePort 10.102.39.197 <none> 443:30306/TCP 69m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/dashboard-metrics-scraper 1/1 1 1 69m
deployment.apps/kubernetes-dashboard 1/1 1 1 69m
NAME DESIRED CURRENT READY AGE
replicaset.apps/dashboard-metrics-scraper-856586f554 1 1 1 69m
replicaset.apps/kubernetes-dashboard-67484c44f6 1 1 1 69m
and
sudo kubectl get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-558bd4d5db-9fxkw 1/1 Running 0 71m
kube-system pod/coredns-558bd4d5db-bq79s 1/1 Running 0 71m
kube-system pod/etcd-dyd-001 1/1 Running 0 71m
kube-system pod/kube-apiserver-dyd-001 1/1 Running 0 71m
kube-system pod/kube-controller-manager-dyd-001 1/1 Running 0 71m
kube-system pod/kube-flannel-ds-amd64-hh5qm 1/1 Running 0 71m
kube-system pod/kube-proxy-4pg4r 1/1 Running 0 71m
kube-system pod/kube-scheduler-dyd-001 1/1 Running 0 71m
kubernetes-dashboard pod/dashboard-metrics-scraper-856586f554-5bps6 1/1 Running 0 71m
kubernetes-dashboard pod/kubernetes-dashboard-67484c44f6-dtc27 1/1 Running 0 71m
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 71m
kube-system service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 71m
kubernetes-dashboard service/dashboard-metrics-scraper ClusterIP 10.107.30.72 <none> 8000/TCP 71m
kubernetes-dashboard service/kubernetes-dashboard NodePort 10.102.39.197 <none> 443:30306/TCP 71m
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/kube-flannel-ds-amd64 1 1 1 1 1 <none> 71m
kube-system daemonset.apps/kube-flannel-ds-arm 0 0 0 0 0 <none> 71m
kube-system daemonset.apps/kube-flannel-ds-arm64 0 0 0 0 0 <none> 71m
kube-system daemonset.apps/kube-flannel-ds-ppc64le 0 0 0 0 0 <none> 71m
kube-system daemonset.apps/kube-flannel-ds-s390x 0 0 0 0 0 <none> 71m
kube-system daemonset.apps/kube-proxy 1 1 1 1 1 kubernetes.io/os=linux 71m
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/coredns 2/2 2 2 71m
kubernetes-dashboard deployment.apps/dashboard-metrics-scraper 1/1 1 1 71m
kubernetes-dashboard deployment.apps/kubernetes-dashboard 1/1 1 1 71m
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/coredns-558bd4d5db 2 2 2 71m
kubernetes-dashboard replicaset.apps/dashboard-metrics-scraper-856586f554 1 1 1 71m
kubernetes-dashboard replicaset.apps/kubernetes-dashboard-67484c44f6 1 1 1 71m
Im following a tutorial to install Kubernetes dashboard. https://k21academy.com/docker-kubernetes/kubernetes-dashboard/ This command will NOT show Kubernetes dashboard, it will show only kubernetes.
In his example it showed kubernetes Metrics scraper and kubernetes dashboard, when I do it it only shows kubernetes. I don't know why
sudo kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 44m
And because of that I can only edit kubernetes with the following command, but I don't want to edit kubernetes. I want to edit service/kubernetes-dashboard instead.
Works but not the correct file I think:
sudo kubectl edit service/kubernetes
Does not work:
sudo kubectl edit service/kubernetes-dashboard
So had used this command instead to edit Kubernetes-dashboard but im not sure if they are the same files:
sudo kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
Question Nr 1.
Why is kubernetes Dashboard and metrics scraper not showing up when I use this command? And how do I make it show up?
sudo kubectl get svc
Question Nr 2.
Are those two commands editing the same file?
sudo kubectl edit service/kubernetes-dashboard
And
sudo kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
Question Nr 3.
If the file I edited with : sudo kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard Is not the same files that is being edited when I use this command:
sudo kubectl edit service/kubernetes-dashboard
How do I fix or revert the changes I made with the first command if im not sure how it previously looked like? Can I delete the file somehow and regenerate it after applying the recommended?
Im trying to install the dashboard and im not getting an external IP.
When you installed dashboard
you used the following command.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml $ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
If you open the recommended.yaml
you will find out that it is using namespace
as
kubernetes-dashboard
. Eg:
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
Answer Nr 2: NO, You are mixing the namespaces, for few of the commands you have used default
namespace. However, for the others you have used kubernetes-dashboard
namespace.
Are those two commands editing the same file?
sudo kubectl edit service/kubernetes-dashboard
And
sudo kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
Answer Nr 3: Same as answer#2. You need to use consistent namespace.
To revert back:
You need delete the resources you created on default namespaces and be consistent with the namespaces. Also, to start fresh, you can use kubectl delete -f <same path as used for installation>
to clean the stuff.
kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
Eg:
kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
namespace "kubernetes-dashboard" deleted
serviceaccount "kubernetes-dashboard" deleted
service "kubernetes-dashboard" deleted
secret "kubernetes-dashboard-certs" deleted
secret "kubernetes-dashboard-csrf" deleted
secret "kubernetes-dashboard-key-holder" deleted
configmap "kubernetes-dashboard-settings" deleted
role.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
clusterrole.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
rolebinding.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
clusterrolebinding.rbac.authorization.k8s.io "kubernetes-dashboard" deleted
deployment.apps "kubernetes-dashboard" deleted
service "dashboard-metrics-scraper" deleted
deployment.apps "dashboard-metrics-scraper" deleted