kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
Creating a Service Account with the name admin-user
in namespace kubernetes-dashboard
first.
dockerui-user-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
kubectl apply -f dockerui-user-account.yaml
dockerui-cluster-role.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
kubectl apply -f dockerui-cluster-role.yaml
kubectl -n kubernetes-dashboard create token admin-user
Copy the token value displayed
kubectl proxy
http:https://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
Paste the token value into the password field
docker pull channel908/simpleapi
app-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: simpleapi-depl
spec:
replicas: 2
selector:
matchLabels:
app: simpleapi
template:
metadata:
labels:
app: simpleapi
spec:
containers:
- name: simpleapi
image: channel908/simpleapi:latest
---
apiVersion: v1
kind: Service
metadata:
name: simpleapi-clusterip-srv
spec:
type: ClusterIP
selector:
app: simpleapi
ports:
- name: simpleapi
protocol: TCP
port: 80
targetPort: 80
kubectl apply -f app-deploy.yaml