Closed ukreddy-erwin closed 4 years ago
if I change to apps/v1 then I am getting below error. $ kubectl create -f influxdb.yaml error: error validating "influxdb.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false
Same problem.
root@kub01:~/kubernetes/dashboard# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
root@kub01:~/kubernetes/dashboard# kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:51:04Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
root@kub01:~/kubernetes/dashboard# kubectl create -f influxdb.yaml
service/monitoring-influxdb created
error: unable to recognize "influxdb.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"
root@kub01:~/kubernetes/dashboard# kubectl api-resources | grep deployment
deployments deploy apps true Deployment
root@kub01:~/kubernetes/dashboard# sed -i 's/extensions\/v1beta1/apps\/v1/g' *.yaml
root@kub01:~/kubernetes/dashboard# kubectl create -f influxdb.yaml
error: error validating "influxdb.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false
I uset that:
# Get UI
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
# Set to kube-system namespace
sed -i 's/namespace: kubernetes-dashboard/namespace: kube-system/g' recommended.yaml
sed -i 's/namespace=kubernetes-dashboard/namespace=kube-system/g' recommended.yaml
# Apply
kubectl apply -f ./recommended.yaml
# Expose port
kubectl delete service kubernetes-dashboard -n kube-system
kubectl expose deploy kubernetes-dashboard -n kube-system --port 8443 --type NodePort
# Show port
kubectl get svc -n kube-system|grep kubernetes-dashboard
# Creating a Service Account
cat <<'EOF' > ServiceAccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
EOF
kubectl create -f ServiceAccount.yaml
# Creating a ClusterRoleBinding
cat <<'EOF' > ClusterRoleBinding.yaml
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: kube-system
EOF
kubectl create -f ClusterRoleBinding.yaml
# Get token
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
Work fine. Kaka smart girl ;)
I'm a stupid girl! Get A-- in summer school. Teacher say: you must use different space name. Soo:
# Apply GUI
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
# Delete service
kubectl delete service kubernetes-dashboard -n kubernetes-dashboard
# Expose service
kubectl expose deploy kubernetes-dashboard -n kubernetes-dashboard --port 8443 --type NodePort
# Show services and ports
kubectl get svc -n kubernetes-dashboard
# Creating a Service Account
cat <<'EOF' > ServiceAccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
EOF
kubectl create -f ServiceAccount.yaml
# Creating a ClusterRoleBinding
cat <<'EOF' > ClusterRoleBinding.yaml
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 create -f ClusterRoleBinding.yaml
# Get token
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
@kapuza Thanks for your help here.
$ kubectl create -f influxdb.yaml service/monitoring-influxdb created error: unable to recognize "influxdb.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"