dashboard 安装harbor
Kubernetes-dashboard:
(所有节点)下载镜像:
docker pull kubernetesui/dashboard:v2.0.3
docker pull kubernetesui/metrics-scraper:v1.0.4
Wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.3/aio/deploy/recommended.yaml 有可能失败
[[email protected] ~]# mkdir /dashboard
[[email protected] ~]# mv recommended.yaml /dashboard/
修改这个文件:
[[email protected] ~]# vim /dashboard/recommended.yaml
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort
ports:
- port: 443
targetPort: 8443
nodePort: 30001
selector:
k8s-app: kubernetes-dashboard
标红为需要添加的
执行文件:
[[email protected] ~]# kubectl apply -f /dashboard/recommended.yaml
查看:
[[email protected] ~]# kubectl get svc -n kubernetes-dashboard
需要指定命名空间
[[email protected] ~]# kubectl get pod -n kubernetes-dashboard
创建用户添加到系统命名空间里:
[[email protected] ~]# kubectl create serviceaccount dashboard-admin -n kube-system
[[email protected] ~]# kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-
需要token才可以进入所以需要查看一下:
[[email protected] ~]# kubectl get secrets -n kube-system 查看那个是dashboard的token dashboard-admin-token这个开头的
[[email protected] ~]# kubectl describe secrets -n kube-system dashboard-admin-token-n66ww
查看 token值
复制token值 登陆页面
复制的token输入这里 即可
页面:
测试:创建一个deployment
[[email protected] ~]# kubectl create deployment nginx --image=nginx
测试网页编辑yml文件
点击右面那三个竖着的符号 选择编辑
更改完后点击更新 等一会就好了
安装harbor:
准备一台主机
K8s-harbor 192.168.2.198 安装好docker和docker-compose 关闭selinux
下载harbor:
https://github.com/goharbor/harbor/releases
解包:
[[email protected] ~]# tar -zxf harbor-offline-installer-v1.10.3.tgz
[[email protected] ~]# cd harbor/
修改文件:
[[email protected] harbor]# vim harbor.yml
修改
hostname: 192.168.2.198
port: 1180
harbor_admin_password: xxx12345
执行prepare:
[[email protected] harbor]# ./prepare
启动harbor:
[[email protected] harbor]# ./install.sh
访问页面:
新键项目
点击公开
选择用户管理-创建用户-填写即可
由于使用的是http不安全所以需要修改:
[[email protected] harbor]# vim /etc/docker/daemon.json
{
“registry-mirrors”: [“https://xxxxxxx.mirror.aliyuncs.com”],
“insecure-registries”: [“192.168.2.198:180”]}
[[email protected] harbor]# systemctl daemon-reload
[[email protected] harbor]# systemctl start docker
[[email protected] harbor]# docker-compose up -d
选择项目-成员
添加刚才创建的用户
回到主机
[[email protected] harbor]# docker login 192.168.2.198:180
Username: test
Password:
填写刚才创建的用户名和密码
打标签上传并测试下载:
[[email protected] harbor]# docker tag busybox:latest 192.168.2.198:180/mysec/busybox:latest
[[email protected] harbor]# docker push 192.168.2.198:180/mysec/busybox
180/mysec/busybox 180/mysec/busybox:latest
[[email protected] harbor]# docker push 192.168.2.198:180/mysec/busybox:latest
测试下载:
[[email protected] harbor]# docker pull 192.168.2.198:180/mysec/busybox
Using default tag: latest
latest: Pulling from mysec/busybox
91f30d776fb2: Pull complete
Digest: sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907
Status: Downloaded newer image for 192.168.2.198:180/mysec/busybox:latest
192.168.2.198:180/mysec/busybox:latest