栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Splunk 第一次成功运行在k8s上

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Splunk 第一次成功运行在k8s上

1: Getting Started with the Splunk Operator for Kubernetes | splunk-operator

2: 开始做准备工作:

Installing the Splunk Operator

A Kubernetes cluster administrator can install and start the Splunk Operator by running:

kubectl apply -f https://github.com/splunk/splunk-operator/releases/download/1.1.0/splunk-operator-install.yaml

kubectl apply -f https://github.com/splunk/splunk-operator/releases/download/1.1.0/splunk-operator-install.yaml

namespace/splunk-operator created

customresourcedefinition.apiextensions.k8s.io/clustermasters.enterprise.splunk.com created

customresourcedefinition.apiextensions.k8s.io/indexerclusters.enterprise.splunk.com created

customresourcedefinition.apiextensions.k8s.io/licensemasters.enterprise.splunk.com created

customresourcedefinition.apiextensions.k8s.io/monitoringconsoles.enterprise.splunk.com created

customresourcedefinition.apiextensions.k8s.io/searchheadclusters.enterprise.splunk.com created

customresourcedefinition.apiextensions.k8s.io/standalones.enterprise.splunk.com created

serviceaccount/splunk-operator-controller-manager created

role.rbac.authorization.k8s.io/splunk-operator-leader-election-role created

clusterrole.rbac.authorization.k8s.io/splunk-operator-manager-role created

clusterrole.rbac.authorization.k8s.io/splunk-operator-metrics-reader created

clusterrole.rbac.authorization.k8s.io/splunk-operator-proxy-role created

rolebinding.rbac.authorization.k8s.io/splunk-operator-leader-election-rolebinding created

clusterrolebinding.rbac.authorization.k8s.io/splunk-operator-manager-rolebinding created

clusterrolebinding.rbac.authorization.k8s.io/splunk-operator-proxy-rolebinding created

configmap/splunk-operator-config created

configmap/splunk-operator-manager-config created

service/splunk-operator-controller-manager-metrics-service created

service/splunk-operator-controller-manager-service created

deployment.apps/splunk-operator-controller-manager created

3: 开始第一个splunk k8s:

cat <

apiVersion: enterprise.splunk.com/v3

kind: Standalone

metadata:

  name: s1

  finalizers:

  - enterprise.splunk.com/delete-pvc

EOF

-------

4: 检查一下pod:

 kubectl get pods

NAME                     READY   STATUS             RESTARTS   AGE

splunk-s1-standalone-0   0/1     ImagePullBackOff   0          5m38s

 kubectl describe pod splunk-s1-standalone-0

......

Events:

  Type     Reason     Age                   From               Message

  ----     ------     ----                  ----               -------

  Normal   Scheduled  6m4s                  default-scheduler  Successfully assigned splunk-operator/splunk-s1-standalone-0 to docker-desktop

  Warning  Failed     4m2s                  kubelet            Failed to pull image "splunk/splunk:8.2.6": rpc error: code = Unknown desc = context canceled

  Warning  Failed     2m53s                 kubelet            Failed to pull image "splunk/splunk:8.2.6": rpc error: code = Unknown desc = Error response from daemon: Head "https://registry-1.docker.io/v2/splunk/splunk/manifests/8.2.6": Get "https://auth.docker.io/token?scope=repository%3Asplunk%2Fsplunk%3Apull&service=registry.docker.io": net/http: request canceled (Client.Timeout exceeded while awaiting headers)

  Normal   Pulling    2m25s (x3 over 6m3s)  kubelet            Pulling image "splunk/splunk:8.2.6"

  Warning  Failed     26s (x3 over 4m2s)    kubelet            Error: ErrImagePull

  Warning  Failed     26s                   kubelet            Failed to pull image "splunk/splunk:8.2.6": rpc error: code = Unknown desc = context deadline exceeded

  Normal   BackOff    1s (x4 over 4m1s)     kubelet            Back-off pulling image "splunk/splunk:8.2.6"

  Warning  Failed     1s (x4 over 4m1s)     kubelet            Error: ImagePullBackOff

5 原来没有splunk/splunk:8.2.6 点镜像:

Docker pull splunk/splunk:8.2.6 就可以了。

4: 启动网页:

kubectl port-forward splunk-s1-standalone-0 8000

5: 删除deployment:

kubectl delete standalone s1

Knowed issue:

kubectl port-forward splunk-s1-standalone-0 8000

Error from server (NotFound): pods "splunk-s1-standalone-0" not found

解决方法:设定namespace:

1: 设定namespace:

 kubectl config set-context --current --namespace=splunk-operator

Context "docker-desktop" modified.

2: 取当前的pod:

 kubectl get pods                                                

NAME                     READY   STATUS    RESTARTS       AGE

splunk-s1-standalone-0   1/1     Running   3 (9m3s ago)   122m

3: 启动网页:

 kubectl port-forward splunk-s1-standalone-0 8000

Forwarding from 127.0.0.1:8000 -> 8000

Forwarding from [::1]:8000 -> 8000

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/978237.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号