農林漁牧網

您現在的位置是:首頁 > 畜牧業

3分鐘入門邊緣計算-kubeedge

2021-12-30由 pythontaotao 發表于 畜牧業

邊緣機率怎麼算

3分鐘入門邊緣計算-kubeedge

什麼是kubeedge:

KubeEdge是一個開源系統,用於將容器化應用程式編排功能擴充套件到Edge的主機。它基於kubernetes構建,併為網路應用程式提供基礎架構支援。雲和邊緣之間的部署和元資料同步。 KubeEdge使用Apache 2。0許可。並且絕對可以免費用於個人或商業用途。

kubeedge目標是建立一個開放平臺,使能邊緣計算,將容器化應用編排功能擴充套件到邊緣的節點和裝置,後者基於kubernetes構建,併為雲和邊緣之間的網路,應用部署和元資料同步提供基礎架構支援。

3分鐘入門邊緣計算-kubeedge

下面我們來安裝一個可以實際操作的kubeedge環境!

一、環境準備,兩節點都需要配置

1。1、主機準備

主機名

IP地址

最低配置

作業系統

核心版本

cloudmaster

10。139。8。210

2C 4G

CentOS 7。6

3。10。0-957。el7。x86_64

cloudedge

10。139。8。211

1C 2G

CentOS 7。6

3。10。0-957。el7。x86_64

1。2、關閉防火牆和selinux

$ systemctl stop firewalld && systemctl disable firewalld$ setenforce 0$ cat /etc/selinux/config #將 SELINUX=enforcing 改為disable# This file controls the state of SELinux on the system。# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced。# permissive - SELinux prints warnings instead of enforcing。# disabled - No SELinux policy is loaded。SELINUX=disabled

1。3、關閉swap分割槽,若沒有swapp分割槽可以忽略不進行操作

$ swapoff -a$ sed -i ‘s/。*swap。*/#&/’ /etc/fstab

1。4、主機名解析

$ echo “10。139。8。210 cloudmaster” >> /etc/hosts$ echo “10。139。8。211 cloudedge” >> /etc/hosts

二、kubeadm安裝kubernetes叢集

2。1、安裝docker (兩節點都需要安裝)

#1、安裝docker依賴軟體包$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2 #2、新增Yum源,國內源速度快很多#國內源安裝快很多$ sudo yum-config-manager \——add-repo https://mirrors。ustc。edu。cn/docker-ce/linux/centos/docker-ce。repo#3、安裝docker-ce$ yum install docker-ce docker-ce-cli containerd。io -y$ systemctl start docker && systemctl enable docker#4、驗證安裝是否成功$ docker versionClient: Docker Engine - Community Version: 20。10。6 API version: 1。41 Go version: go1。13。15 Git commit: 370c289 Built: Fri Apr 9 22:45:33 2021 OS/Arch: linux/amd64 Context: default Experimental: trueServer: Docker Engine - Community Engine: Version: 20。10。6 API version: 1。41 (minimum version 1。12) Go version: go1。13。15 Git commit: 8728dd2 Built: Fri Apr 9 22:43:57 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1。4。6 GitCommit: d71fcd7d8303cbf684402823e425e9dd2e99285d runc: Version: 1。0。0-rc95 GitCommit: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7 docker-init: Version: 0。19。0 GitCommit: de40ad0

2。2、安裝k8s叢集,只需要在cloudmaster上進行安裝,cloudedge不需要join到叢集

#1、配置核心引數,將橋接的IPv4流量傳遞到iptables的鏈 $ cat > /etc/sysctl。d/k8s。conf < /etc/yum。repos。d/kubernetes。repo[kubernetes]name=Kubernetesbaseurl=https://mirrors。aliyun。com/kubernetes/yum/repos/kubernetes-el7-x86_64/enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://mirrors。aliyun。com/kubernetes/yum/doc/yum-key。gpg https://mirrors。aliyun。com/kubernetes/yum/doc/rpm-package-key。gpgEOF#3、安裝kubectl、kubeadm、kubelet$ yum install -y kubelet-1。17。1 kubeadm-1。17。1 kubectl-1。17。1#4、初始化叢集,在cloudmaster上執行kubeadm init$ kubeadm init ——kubernetes-version=1。17。1 \——apiserver-advertise-address=10。139。8。210 \——image-repository registry。aliyuncs。com/google_containers \——service-cidr=10。96。0。0/12 \——pod-network-cidr=10。244。0。0/16 //以下是執行完畢後輸出的部分資訊Your Kubernetes control-plane has initialized successfully! To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/。kube sudo cp -i /etc/kubernetes/admin。conf $HOME/。kube/config sudo chown $(id -u):$(id -g) $HOME/。kube/config You should now deploy a pod network to the cluster。Run “kubectl apply -f [podnetwork]。yaml” with one of the options listed at: https://kubernetes。io/docs/concepts/cluster-administration/addons/ Then you can join any number of worker nodes by running the following on each as root: kubeadm join 192。168。100。150:6443 ——token cxins6。pxbyomo4pp1mnrao \ ——discovery-token-ca-cert-hash sha256:35876ef6f2e5fe7eb5c7bb709dbd5e09d0e9e7d3adf41cbe708eec4fb586c8d6 #5、配置kubectl工具$ mkdir -p /root/。kube$ sudo cp /etc/kubernetes/admin。conf /root/。kube/config$ sudo chown $(id -u):$(id -g) $HOME/。kube/config#6、檢視主節點狀態$ NAME STATUS ROLES AGE VERSIONmaster NotReady master 27h v1。17。1#7、部署flannel網路$ kubectl apply -f https://raw。githubusercontent。com/coreos/flannel/master/Documentation/kube-flannel。yml

三、安裝kubeedge叢集

3。1、安裝CloudCore (在cloudmaster節點操作)

安裝有兩種方式,一種原始碼編譯手動安裝,還有一種是使用ke提供的工具-keadm。手動安裝比較繁瑣,對於新手而言是一種很大的心智負擔,最好大家還是都用keadm這個工具去安裝,但是,這種方式安裝最大的問題就是國內的牆的問題會導致很多某些資源無法下載,比如說 CRD的yaml,cloudcore啟動的service,所以我會結合兩者,採用半手動半工具的安裝方式去完成ke的叢集搭建。

#1、下載keadm$ wget https://github。com/kubeedge/kubeedge/releases/download/v1。5。0/keadm-v1。5。0-linux-amd64。tar。gz #解壓$ tar -zxvf keadm-v1。5。0-linux-amd64。tar。gz $ cd keadm-v1。5。0-linux-amd64/keadm && chmod +x keadm && mv keadm /usr/local/bin#驗證keadm是否安裝成功$ keadm versionversion: version。Info{Major:“1”, Minor:“5”, GitVersion:“v1。5。0”, GitCommit:“8b0913e04ef4ef826af6715d336e23a66e3774df”, GitTreeState:“clean”, BuildDate:“2020-11-13T08:04:56Z”, GoVersion:“go1。15”, Compiler:“gc”, Platform:“linux/amd64”}#2、使用keadm安裝cloudcorekeadm init ——advertise-address=10。139。8。210 ——kubeedge-version=1。5。0Kubernetes version verification passed, KubeEdge installation will start。。。——2021-06-1 13:20:41—— https://raw。githubusercontent。com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha2_device。yamlResolving raw。githubusercontent。com (raw。githubusercontent。com)。。。 151。101。76。133Connecting to raw。githubusercontent。com (raw。githubusercontent。com)|151。101。76。133|:443。。。 connected。Unable to establish SSL connection。Converted links in 0 files in 0 seconds。Error: failed to run ‘sh -c cd /etc/kubeedge/crds/devices && wget -k ——no-check-certificate ——progress=bar:force https://raw。githubusercontent。com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha2_device。yaml’ because of error : exit status 4Usage: keadm init [flags]Examples:keadm init- This command will download and install the default version of KubeEdge cloud componentkeadm init ——kubeedge-version=1。5。0 ——kube-config=/root/。kube/config - kube-config is the absolute path of kubeconfig which used to secure connectivity between cloudcore and kube-apiserverFlags: ——advertise-address string Use this key to set IPs in cloudcore‘s certificate SubAltNames field。 eg: 10。10。102。78,10。10。102。79 ——domainname string Use this key to set domain names in cloudcore’s certificate SubAltNames field。 eg: www。cloudcore。cn,www。kubeedge。cn -h, ——help help for init ——kube-config string Use this key to set kube-config path, eg: $HOME/。kube/config (default “/root/。kube/config”) ——kubeedge-version string Use this key to download and use the required KubeEdge version ——master string Use this key to set K8s master address, eg: http://127。0。0。1:8080 ——tarballpath string Use this key to set the temp directory path for KubeEdge tarball, if not exist, download itF0211 13:20:41。433946 15198 keadm。go:27] failed to run ‘sh -c cd /etc/kubeedge/crds/devices && wget -k ——no-check-certificate ——progress=bar:force https://raw。githubusercontent。com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha2_device。yaml’ because of error : exit status 4goroutine 1 [running]:k8s。io/klog。stacks(0xc0000d3e00, 0xc000026480, 0x122, 0x176) /root/codes/src/github。com/kubeedge/kubeedge/vendor/k8s。io/klog/klog。go:883 +0xb9k8s。io/klog。(*loggingT)。output(0x2cb3c80, 0xc000000003, 0xc0000b4b60, 0x29d13f1, 0x8, 0x1b, 0x0) /root/codes/src/github。com/kubeedge/kubeedge/vendor/k8s。io/klog/klog。go:834 +0x35fk8s。io/klog。(*loggingT)。printDepth(0x2cb3c80, 0xc000000003, 0x1, 0xc000843f68, 0x1, 0x1) /root/codes/src/github。com/kubeedge/kubeedge/vendor/k8s。io/klog/klog。go:706 +0x12dk8s。io/klog。(*loggingT)。print(。。。) /root/codes/src/github。com/kubeedge/kubeedge/vendor/k8s。io/klog/klog。go:697k8s。io/klog。Fatal(。。。) /root/codes/src/github。com/kubeedge/kubeedge/vendor/k8s。io/klog/klog。go:1264main。main() /root/codes/src/github。com/kubeedge/kubeedge/keadm/cmd/keadm/keadm。go:27 +0x8a

——advertise-address=xxx。xx。xx。xx 這裡的xxx。xx。xx。xx換成master機器的ip,可以是內網地址,也可以是公網ip地址,——kubeedge-version=1。5。0 意思是指定安裝的ke的版本,如果你預設不指定那麼keadm會自動去下載最新的版本。很遺憾,我在執行

keadm init ——advertise-address=xxx。xx。xx。xx ——kubeedge-version=1。5。0

命令的時候出錯了,這個錯的問題在於網路被牆了,特別是在公有云的虛擬機器上,出現這種問題的機率特別大,這種問題咋解決,一種是翻牆翻出去,另外一種是在/etc/hosts下新增如下內容

# GitHub Start52。74。223。119 github。com192。30。253。119 gist。github。com54。169。195。247 api。github。com185。199。111。153 assets-cdn。github。com151。101。76。133 raw。githubusercontent。com151。101。108。133 user-images。githubusercontent。com151。101。76。133 gist。githubusercontent。com151。101。76。133 cloud。githubusercontent。com151。101。76。133 camo。githubusercontent。com151。101。76。133 avatars0。githubusercontent。com151。101。76。133 avatars1。githubusercontent。com151。101。76。133 avatars2。githubusercontent。com151。101。76。133 avatars3。githubusercontent。com151。101。76。133 avatars4。githubusercontent。com151。101。76。133 avatars5。githubusercontent。com151。101。76。133 avatars6。githubusercontent。com151。101。76。133 avatars7。githubusercontent。com151。101。76。133 avatars8。githubusercontent。com# GitHub End

3。2、離線下載安裝過程對應的檔案

如果試了上述方法還是不行,只能手動把相對應的檔案下載到本地,下載地址 https://github。com/kubeedge/kubeedge/tree/master/build/crds

$ mkdir -p /etc/kubeedge/crds/devices && mkdir -p /etc/kubeedge/crds/reliablesyncs

1)、devices_v1alpha2_devicemodel。yaml

apiVersion: apiextensions。k8s。io/v1beta1kind: CustomResourceDefinitionmetadata: name: devicemodels。devices。kubeedge。iospec: group: devices。kubeedge。io names: kind: DeviceModel plural: devicemodels scope: Namespaced validation: openAPIV3Schema: properties: apiVersion: description: ‘APIVersion defines the versioned schema of this representation of an object。 Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#resources’ type: string kind: description: ‘Kind is a string value representing the REST resource this object represents。 Servers may infer this from the endpoint the client submits requests to。 Cannot be updated。 In CamelCase。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#types-kinds’ type: string metadata: type: object spec: properties: properties: description: ‘Required: List of device properties。’ items: properties: description: description: The device property description。 type: string name: description: ‘Required: The device property name。’ type: string type: description: ‘Required: PropertyType represents the type and data validation of the property。’ properties: int: properties: accessMode: description: ‘Required: Access mode of property, ReadWrite or ReadOnly。’ type: string enum: - ReadOnly - ReadWrite defaultValue: format: int64 type: integer maximum: format: int64 type: integer minimum: format: int64 type: integer unit: description: The unit of the property type: string required: - accessMode type: object string: properties: accessMode: description: ‘Required: Access mode of property, ReadWrite or ReadOnly。’ type: string enum: - ReadOnly - ReadWrite defaultValue: type: string required: - accessMode type: object double: properties: accessMode: description: ‘Required: Access mode of property, ReadWrite or ReadOnly。’ type: string enum: - ReadOnly - ReadWrite defaultValue: format: double type: number maximum: format: double type: number minimum: format: double type: number unit: description: The unit of the property type: string required: - accessMode type: object float: properties: accessMode: description: ‘Required: Access mode of property, ReadWrite or ReadOnly。’ type: string enum: - ReadOnly - ReadWrite defaultValue: format: float type: number maximum: format: float type: number minimum: format: float type: number unit: description: The unit of the property type: string required: - accessMode type: object boolean: properties: accessMode: description: ‘Required: Access mode of property, ReadWrite or ReadOnly。’ type: string enum: - ReadOnly - ReadWrite defaultValue: type: boolean required: - accessMode type: object bytes: properties: accessMode: description: ‘Required: Access mode of property, ReadWrite or ReadOnly。’ type: string enum: - ReadOnly - ReadWrite required: - accessMode type: object type: object required: - name - type type: object type: array type: object version: v1alpha2

2)、devices_v1alpha2_device。yaml

apiVersion: apiextensions。k8s。io/v1beta1kind: CustomResourceDefinitionmetadata: labels: controller-tools。k8s。io: “1。0” name: devices。devices。kubeedge。iospec: group: devices。kubeedge。io names: kind: Device plural: devices scope: Namespaced validation: openAPIV3Schema: properties: apiVersion: description: ‘APIVersion defines the versioned schema of this representation of an object。 Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#resources’ type: string kind: description: ‘Kind is a string value representing the REST resource this object represents。 Servers may infer this from the endpoint the client submits requests to。 Cannot be updated。 In CamelCase。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#types-kinds’ type: string metadata: type: object spec: properties: deviceModelRef: description: ‘Required: DeviceModelRef is reference to the device model used as a template to create the device instance。’ type: object nodeSelector: description: NodeSelector indicates the binding preferences between devices and nodes。 Refer to k8s。io/kubernetes/pkg/apis/core NodeSelector for more details type: object protocol: description: ‘Required: The protocol configuration used to connect to the device。’ properties: bluetooth: description: Protocol configuration for bluetooth properties: macAddress: description: Unique identifier assigned to the device。 type: string type: object modbus: description: Protocol configuration for modbus properties: slaveID: description: Required。 0-255 format: int64 type: integer minimum: 0 maximum: 255 required: - slaveID type: object opcua: description: Protocol configuration for opc-ua properties: certificate: description: Certificate for access opc server。 type: string password: description: Password for access opc server。 type: string privateKey: description: PrivateKey for access opc server。 type: string securityMode: description: Defaults to “none”。 type: string securityPolicy: description: Defaults to “none”。 type: string timeout: description: Timeout seconds for the opc server connection。??? format: int64 type: integer url: description: ‘Required: The URL for opc server endpoint。’ type: string userName: description: Username for access opc server。 type: string required: - url type: object common: description: Common part of protocol configuration properties: com: properties: baudRate: description: Required。 BaudRate 115200|57600|38400|19200|9600|4800|2400|1800|1200|600|300|200|150|134|110|75|50 format: int64 type: integer enum: - 115200 - 57600 - 38400 - 19200 - 9600 - 4800 - 2400 - 1800 - 1200 - 600 - 300 - 200 - 150 - 134 - 110 - 75 - 50 dataBits: description: Required。 Valid values are 8, 7, 6, 5。 format: int64 type: integer enum: - 8 - 7 - 6 - 5 parity: description: Required。 Valid options are “none”, “even”, “odd”。 Defaults to “none”。 type: string enum: - none - even - odd serialPort: description: Required。 type: string stopBits: description: Required。 Bit that stops 1|2 format: int64 type: integer enum: - 1 - 2 required: - baudRate - dataBits - parity - serialPort - stopBits type: object tcp: properties: ip: description: Required。 type: string port: description: Required。 format: int64 type: integer required: - ip - port type: object commType: description: Communication type, like tcp client, tcp server or COM type: string reconnTimeout: description: Reconnection timeout type: integer reconnRetryTimes: description: Reconnecting retry times type: integer collectTimeout: description: ‘Define timeout of mapper collect from device。’ format: int64 type: integer collectRetryTimes: description: ‘Define retry times of mapper will collect from device。’ format: int64 type: integer collectType: description: ‘Define collect type, sync or async。’ type: string enum: - sync - async customizedValues: description: Customized values for provided protocol type: object type: object customizedProtocol: description: Protocol configuration for customized Protocol properties: protocolName: description: The name of protocol type: string configData: description: customized config data type: object required: - protocolName type: object type: object propertyVisitors: description: ‘Required: List of property visitors which describe how to access the device properties。 PropertyVisitors must unique by propertyVisitor。propertyName。’ items: properties: bluetooth: description: Bluetooth represents a set of additional visitor config fields of bluetooth protocol。 properties: characteristicUUID: description: ‘Required: Unique ID of the corresponding operation’ type: string dataConverter: description: Responsible for converting the data being read from the bluetooth device into a form that is understandable by the platform properties: endIndex: description: ‘Required: Specifies the end index of incoming byte stream to be considered to convert the data the value specified should be inclusive for example if 3 is specified it includes the third index’ format: int64 type: integer orderOfOperations: description: Specifies in what order the operations(which are required to be performed to convert incoming data into understandable form) are performed items: properties: operationType: description: ‘Required: Specifies the operation to be performed to convert incoming data’ type: string enum: - Add - Subtract - Multiply - Divide operationValue: description: ‘Required: Specifies with what value the operation is to be performed’ format: double type: number type: object type: array shiftLeft: description: Refers to the number of bits to shift left, if left-shift operation is necessary for conversion format: int64 type: integer shiftRight: description: Refers to the number of bits to shift right, if right-shift operation is necessary for conversion format: int64 type: integer startIndex: description: ‘Required: Specifies the start index of the incoming byte stream to be considered to convert the data。 For example: start-index:2, end-index:3 concatenates the value present at second and third index of the incoming byte stream。 If we want to reverse the order we can give it as start-index:3, end-index:2’ format: int64 type: integer required: - endIndex - startIndex type: object dataWrite: description: ‘Responsible for converting the data coming from the platform into a form that is understood by the bluetooth device For example: “ON”:[1], “OFF”:[0]’ type: object required: - characteristicUUID type: object modbus: description: Modbus represents a set of additional visitor config fields of modbus protocol。 properties: isRegisterSwap: description: Indicates whether the high and low register swapped。 Defaults to false。 type: boolean isSwap: description: Indicates whether the high and low byte swapped。 Defaults to false。 type: boolean limit: description: ‘Required: Limit number of registers to read/write。’ format: int64 type: integer offset: description: ‘Required: Offset indicates the starting register number to read/write data。’ format: int64 type: integer register: description: ‘Required: Type of register’ type: string enum: - CoilRegister - DiscreteInputRegister - InputRegister - HoldingRegister scale: description: The scale to convert raw property data into final units。 Defaults to 1。0 format: double type: number required: - limit - offset - register type: object opcua: description: Opcua represents a set of additional visitor config fields of opc-ua protocol。 properties: browseName: description: The name of opc-ua node type: string nodeID: description: ‘Required: The ID of opc-ua node, e。g。 “ns=1,i=1005”’ type: string required: - nodeID type: object customizedProtocol: description: customized protocol properties: protocolName: description: The name of protocol type: string configData: description: customized config data type: object required: - protocolName - configData type: object propertyName: description: ‘Required: The device property name to be accessed。 This should refer to one of the device properties defined in the device model。’ type: string reportCycle: description: ‘Define how frequent mapper will report the value。’ format: int64 type: integer collectCycle: description: ‘Define how frequent mapper will collect from device。’ format: int64 type: integer customizedValues: description: Customized values for visitor of provided protocols type: object required: - propertyName type: object type: array data: properties: dataTopic: description: ‘Topic used by mapper, all data collected from dataProperties should be published to this topic, the default value is $ke/events/device/+/data/update’ type: string dataProperties: description: A list of data properties, which are not required to be processed by edgecore items: properties: propertyName: description: ‘Required: The property name for which the desired/reported values are specified。 This property should be present in the device model。’ type: string metadata: description: Additional metadata like filter policy, should be k-v format type: object required: - propertyName type: object type: array type: object required: - deviceModelRef - nodeSelector type: object status: properties: twins: description: A list of device twins containing desired/reported desired/reported values of twin properties。 A passive device won‘t have twin properties and this list could be empty。 items: properties: desired: description: ’Required: the desired property value。‘ properties: metadata: description: Additional metadata like timestamp when the value was reported etc。 type: object value: description: ’Required: The value for this property。‘ type: string required: - value type: object propertyName: description: ’Required: The property name for which the desired/reported values are specified。 This property should be present in the device model。‘ type: string reported: description: ’Required: the reported property value。‘ properties: metadata: description: Additional metadata like timestamp when the value was reported etc。 type: object value: description: ’Required: The value for this property。‘ type: string required: - value type: object required: - propertyName type: object type: array type: object version: v1alpha2

3)、cluster_objectsync_v1alpha1。yaml

apiVersion: apiextensions。k8s。io/v1beta1kind: CustomResourceDefinitionmetadata: labels: controller-tools。k8s。io: “1。0” name: clusterobjectsyncs。reliablesyncs。kubeedge。iospec: group: reliablesyncs。kubeedge。io names: kind: ClusterObjectSync plural: clusterobjectsyncs scope: Cluster subresources: status: {} validation: openAPIV3Schema: properties: apiVersion: description: ’APIVersion defines the versioned schema of this representation of an object。 Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#resources‘ type: string kind: description: ’Kind is a string value representing the REST resource this object represents。 Servers may infer this from the endpoint the client submits requests to。 Cannot be updated。 In CamelCase。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#types-kinds‘ type: string metadata: type: object spec: properties: objectType: description: NodeSelector indicates the binding preferences between devices and nodes。 Refer to k8s。io/kubernetes/pkg/apis/core NodeSelector for more details type: string objectName: description: ’Required: The protocol configuration used to connect to the device。‘ type: string status: properties: objectResourceVersion: description: ’Required: DeviceModelRef is reference to the device model used as a template to create the device instance。‘ type: string version: v1alpha1

4)、objectsync_v1alpha1。yaml

apiVersion: apiextensions。k8s。io/v1beta1kind: CustomResourceDefinitionmetadata: labels: controller-tools。k8s。io: “1。0” name: objectsyncs。reliablesyncs。kubeedge。iospec: group: reliablesyncs。kubeedge。io names: kind: ObjectSync plural: objectsyncs scope: Namespaced subresources: status: {} validation: openAPIV3Schema: properties: apiVersion: description: ’APIVersion defines the versioned schema of this representation of an object。 Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#resources‘ type: string kind: description: ’Kind is a string value representing the REST resource this object represents。 Servers may infer this from the endpoint the client submits requests to。 Cannot be updated。 In CamelCase。 More info: https://git。k8s。io/community/contributors/devel/api-conventions。md#types-kinds‘ type: string metadata: type: object spec: properties: objectType: description: NodeSelector indicates the binding preferences between devices and nodes。 Refer to k8s。io/kubernetes/pkg/apis/core NodeSelector for more details type: string objectName: description: ’Required: The protocol configuration used to connect to the device。‘ type: string status: properties: objectResourceVersion: description: ’Required: DeviceModelRef is reference to the device model used as a template to create the device instance。‘ type: string version: v1alpha1

5)、cloudcore。service

[Unit]Description=cloudcore。service[Service]Type=simpleExecStart=/etc/kubeedge/kubeedge-v1。5。0-linux-amd64/cloud/cloudcore/cloudcore ——logtostderr=false ——log-file=/var/log/kubeedge/cloudcore。log -v=3Restart=alwaysRestartSec=10[Install]WantedBy=multi-user。target

6)、kubeedge-v1。5。0-linux-amd64。tar。gz

$ wget https://github。com/kubeedge/kubeedge/releases/download/v1。5。0/kubeedge-v1。5。0-linux-amd64。tar。gz

3。3、準備完成後進行初始化

$ keadm init ——advertise-address=10。139。8。210 ——kubeedge-version=1。5。0Kubernetes version verification passed, KubeEdge installation will start。。。Expected or Default KubeEdge version 1。5。0 is already downloaded and will checksum for it。kubeedge-v1。5。0-linux-amd64。tar。gz checksum:checksum_kubeedge-v1。5。0-linux-amd64。tar。gz。txt content:[Run as service] service file already exisits in /etc/kubeedge//cloudcore。service, skip downloadkubeedge-v1。5。0-linux-amd64/kubeedge-v1。5。0-linux-amd64/edge/kubeedge-v1。5。0-linux-amd64/edge/edgecorekubeedge-v1。5。0-linux-amd64/cloud/kubeedge-v1。5。0-linux-amd64/cloud/csidriver/kubeedge-v1。5。0-linux-amd64/cloud/csidriver/csidriverkubeedge-v1。5。0-linux-amd64/cloud/admission/kubeedge-v1。5。0-linux-amd64/cloud/admission/admissionkubeedge-v1。5。0-linux-amd64/cloud/cloudcore/kubeedge-v1。5。0-linux-amd64/cloud/cloudcore/cloudcorekubeedge-v1。5。0-linux-amd64/versionKubeEdge cloudcore is running, For logs visit: /var/log/kubeedge/cloudcore。logCloudCore started

如果你想把cloudcore交給systemed託管的話切記把cloudcore。service移到

/etc/systemed/system

下面然後再執行下

systemctl daemon-reload

3。4、檢視cloudedge加入叢集的token

$ keadm gettoken48ce0f652d396b56ce2b814a62fd85833e3b02273b374aca3d53557d98d375be。eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9。eyJleHAiOjE2MjI2MDA3ODB9。JnW6PfLFEldpAZkNgoAe6Aaw2l0H11MtZIUjB1zfTk4

3。4、安裝edgecore

#安裝keadm命令$ mkdir -p /etc/kubeedge && wget https://github。com/kubeedge/kubeedge/releases/download/v1。5。0/kubeedge-v1。5。0-linux-arm。tar。gz#加入叢集$ keadm join ——cloudcore-ipport=xx。xx。xx。xx:10000 ——kubeedge-version=1。5。0 ——token=-cloudcore-ipport表示的是cloudcore的對外暴露的ip就是公網ip了,如果你是在公有云伺服器上的記得開啟安全組的埠——kubeedge-version就是ke的版本——token= 這個token是上一步叢集的token

3。5、檢查ke叢集是否安裝完成

[root@master kubeedge]# kubectl get noNAME STATUS ROLES AGE VERSIONcloudmaster Ready cloudmaster 27h v1。17。1cloudedge Ready agent,edge 4h24m v1。19。3-kubeedge-v1。5。0

總結:kubeedge的安裝到此結束,有想學習的小夥伴快快開始吧,當然學習kubeedge之前最好先了解一下kubernetes技術,這樣不至於在操作的時候不知所措了。