
云原生
利用kurise做日志采集使用promtail做sidecar采集日志
利用OpenKurise中的kruise做日志采集,原来我使用的是filebeat作为sidecar采集日志的,虽然采集没有什么问题,但是通过es进才看日志就比较繁琐了,这次实验p
[root@www.wulaoer.org 2.0]# kubectl apply -f prometheus.yaml serviceaccount/prometheus-serviceaccount unchanged clusterrole.rbac.authorization.k8s.io/prometheus unchanged clusterrolebinding.rbac.authorization.k8s.io/prometheus unchanged service/prometheus unchanged error: unable to recognize "prometheus.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"问题的原因是因为,Kubernetes已经从v1.16.2版本中Deployment 已经被extensions/v1beta1 弃用,所以我们直接替换成apps/v1即可。
apiVersion: extensions/v1beta1 kind: Deployment 替换成 apiVersion: apps/v1 kind: Deployment可以看一下我的Kubernetes版本
[root@www.wulaoer.org ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:18:23Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
[root@www.wulaoer.org 2.0]# kubectl apply -f prometheus.yaml serviceaccount/prometheus-serviceaccount unchanged clusterrole.rbac.authorization.k8s.io/prometheus unchanged clusterrolebinding.rbac.authorization.k8s.io/prometheus unchanged error: error validating "prometheus.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false解决方法,就是在你的spec下加一个selector,selector下的app名称必须要和定义的程序名称一致。
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: prometheus-deployment
name: prometheus
namespace: prometheus
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
我是直接在replicas下插入的seector,重新创建问题解决。
评论 0