k8s安装attu

官方文档里就这么一句安装attu,但是脚本里的镜像,我们无法访问,我们需要修改自定义的镜像
kubectl apply -f https://raw.githubusercontent.com/zilliztech/attu/main/attu-k8s-deploy.yaml

1.下载yaml文件
[root@master my_yaml]# cd /root/my_yaml
[root@master my_yaml]#wget https://raw.githubusercontent.com/zilliztech/attu/main/attu-k8s-deploy.yaml


2.修改yaml文件
2.1 修改为自定义的镜像
image: zilliz/attu:v2.4
修改为:
image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/attu:v2.4.7

2.2 修改为NodePort访问
type: ClusterIP
修改为:
type: NodePort

 

3.部署
[root@master my_yaml]# cd /root/my_yaml
[root@master my_yaml]# kubectl apply -f attu-k8s-deploy.yaml
service/my-attu-svc created
deployment.apps/my-attu created

 

查看

[root@master my_yaml]# kubectl get pods -A
NAMESPACE            NAME                                             READY   STATUS    RESTARTS       AGE
cert-manager         cert-manager-56c56f4bc8-6t6lj                    1/1     Running   1 (84m ago)    44h
cert-manager         cert-manager-cainjector-684cbdfb-w5hxs           1/1     Running   1 (84m ago)    44h
cert-manager         cert-manager-webhook-6fff7f86d5-lf5qs            1/1     Running   1 (84m ago)    44h
default              my-attu-85f44d59fb-v4njg                         1/1     Running   0              101s

查看服务情况

[root@master my_yaml]# kubectl get svc my-attu-svc
NAME          TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
my-attu-svc   NodePort   10.105.191.163   <none>        3000:30340/TCP   26m

我们这里需要通过30340端口访问

 

4.浏览器访问

nodeip:30340

每个nodeip都可以访问

 

5.yaml文件

[root@master my_yaml]# more attu-k8s-deploy.yaml 
apiVersion: v1
kind: Service
metadata:
  name: my-attu-svc
  labels:
    app: attu
spec:
  type: NodePort
  ports:
  - name: attu
    protocol: TCP
    port: 3000
    targetPort: 3000
  selector:
    app: attu
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-attu
  labels:
    app: attu
spec:
  replicas: 1
  selector:
    matchLabels:
      app: attu
  template:
    metadata:
      labels:
        app: attu
    spec:
      containers:
      - name: attu
        image: registry.cn-shenzhen.aliyuncs.com/hxlk8s/attu:v2.4.7
        imagePullPolicy: IfNotPresent
        ports:
        - name: attu
          containerPort: 3000
          protocol: TCP
        env:
        - name: MILVUS_URL
          value: "my-release-milvus:19530"

 

说明:

可以使用如下命令将本机端口映射到pod端口,但是Ctrl+c 会中断.

kubectl port-forward --address 0.0.0.0 svc/my-attu-svc 3000:3000

 

posted @ 2025-01-02 14:51  slnngk  阅读(2)  评论(0编辑  收藏  举报