ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

k8s 自定义informer

2021-07-08 12:03:03  阅读:239  来源: 互联网

标签:downloading reflector 自定义 tw cloudnative go informer k8s v0.0


 

it clone https://github.com/kairen/controller101.git

 

root@ubuntu:~/controller101# make
go build -ldflags="-s -w -X github.com/cloud-native-taiwan/controller101/pkg/version.version=v0.1.0" \
  -a -o out/controller cmd/main.go
go: downloading k8s.io/client-go v0.0.0-20191005115821-b1fd78950135
go: downloading github.com/spf13/pflag v1.0.3
go: downloading k8s.io/apimachinery v0.0.0-20191005115455-e71eb83a557c
go: downloading github.com/thoas/go-funk v0.4.0
go: downloading github.com/docker/go-connections v0.4.0
go: downloading github.com/pkg/errors v0.8.1
go: downloading golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc
go: downloading github.com/docker/go-units v0.4.0
go: downloading golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db
go: downloading k8s.io/api v0.0.0-20191005115622-2e41325d9e4b
go: downloading golang.org/x/time v0.0.0-20161028155119-f51c12702a4d
go: downloading k8s.io/utils v0.0.0-20190920012459-5008bf6f8cd6
go: downloading gopkg.in/yaml.v2 v2.2.4
go: downloading golang.org/x/crypto v0.0.0-20181025213731-e84da0312774
go: downloading golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
go: downloading golang.org/x/sys v0.0.0-20190209173611-3b5209105503

 

 

root@ubuntu:~/controller101# go run cmd/main.go --kubeconfig=$HOME/.kube/config -v=2 --logtostderr  --vm-driver=docker  --lease-lock-namespace=default
I0708 11:46:39.735032   28294 leaderelection.go:242] attempting to acquire leader lease  default/controller101...
I0708 11:46:39.769316   28294 leaderelection.go:252] successfully acquired lease default/controller101
I0708 11:46:39.769415   28294 controller.go:77] Starting the controller
I0708 11:46:39.769439   28294 controller.go:78] Waiting for the informer caches to sync
E0708 11:46:39.771949   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:40.773790   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:41.775497   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:42.777139   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:43.778515   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:44.779683   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:45.781476   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)
E0708 11:46:46.782890   28294 reflector.go:153] pkg/mod/k8s.io/client-go@v0.0.0-20191005115821-b1fd78950135/tools/cache/reflector.go:105: Failed to list *v1alpha1.VirtualMachine: the server could not find the requested resource (get virtualmachines.cloudnative.tw)

 

 

root@ubuntu:~/kube-batch/pkg# cat <<EOF | kubectl apply -f -
> apiVersion: cloudnative.tw/v1alpha1
> kind: VirtualMachine
> metadata:
>   name: test-vm
> spec:
>   resource:
>     cpu: 2
>     memory: 4G
> EOF
virtualmachine.cloudnative.tw/test-vm createderror: unable to recognize "STDIN": no matches for kind "VirtualMachine" in version "cloudnative.tw/v1alpha1"
root@ubuntu:~/kube-batch/pkg# cd ~
root@ubuntu:~# cat<<EOF >vm.yaml
>  
> apiVersion: cloudnative.tw/v1alpha1
> kind: VirtualMachine
> metadata:
>   name: test-vm
> spec:
>   resource:
>     cpu: 2
>     memory: 4G
> EOF
root@ubuntu:~# kubectl apply -f vm.yaml 
error: unable to recognize "vm.yaml": no matches for kind "VirtualMachine" in version "cloudnative.tw/v1alpha1"
root@ubuntu:~# cat vm.yaml 
 
apiVersion: cloudnative.tw/v1alpha1
kind: VirtualMachine
metadata:
  name: test-vm
spec:
  resource:
    cpu: 2
    memory: 4G
root@ubuntu:~# 

 

标签:downloading,reflector,自定义,tw,cloudnative,go,informer,k8s,v0.0
来源: https://www.cnblogs.com/dream397/p/14985457.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有