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



