赞
踩
https://kubeedge.io/en/docs/setup/keadm/
选择v1.12.1
wget https://github.com/kubeedge/kubeedge/releases/download/v1.12.1/keadm-v1.12.1-linux-amd64.tar.gz
tar -zxvf keadm-v1.12.1-linux-amd64.tar.gz
cp keadm-v1.12.1-linux-amd64/keadm/keadm /usr/local/bin/keadm
keadm init --advertise-address="192.168.19.133" --profile version=v1.12.1 --kube-config=/root/.kube/config --set cloudCore.hostNetWork="false"
最新的云端是以容器化的方式运行
我这边没有公网IP,所有云端的端口均以NodePort的形式暴露,cloudCore.hostNetWork 设置为true
30000:10000
30001:10001
30002:10002
30003:10003
30004:10004
kubectl get daemonsets.apps -n kube-system | grep -v NAME | awk '{print $1}' | xargs -n 1 kubectl patch daemonset -n kube-system --type='json' -p='[{"op":"replace","path":"/spec/template/spec/affinity","value":{"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"node-role.kubernetes.io/edge","operator":"DoesNotExist"}]}]}}}}]'
修改calicl-node kube-proxy nodelocaldns组件的亲和性,运行在非边缘节点
边缘端新建一个虚拟机
ip: 192.168.19.139
hostname: edgenode1
yum remove docker*
curl https://get.docker.com | bash
systemctl disable docker.service
systemctl start docker.service
keadm gettoken
1f872fbcc3a7d5c17585b337d44c198799f42d7ec0d71dace046317aea98482b.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Nzc1NDc4MDF9.f9j8yvYWHf_bHzyykd7Dxrxg7gdR5OGD7NS58EBk6Tc
TOKEN=1f872fbcc3a7d5c17585b337d44c198799f42d7ec0d71dace046317aea98482b.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Nzc1NDc4MDF9.f9j8yvYWHf_bHzyykd7Dxrxg7gdR5OGD7NS58EBk6Tc
SERVER=192.168.19.133:30001
keadm join --cloudcore-ipport=$SERVER --kubeedge-version=v1.12.1 --token=$TOKEN
由于cloud端用的是NodePort,所以edge端有些默认端口需要修改,配置文件在/etc/kubeedge/config/edgecore.yaml
主要将10000 10001 10002 10003 10004这些端口改为NodePort的映射端口
apiVersion: edgecore.config.kubeedge.io/v1alpha2 database: aliasName: default dataSource: /var/lib/kubeedge/edgecore.db driverName: sqlite3 kind: EdgeCore modules: dbTest: enable: false deviceTwin: enable: true edgeHub: enable: true heartbeat: 15 httpServer: https://192.168.19.133:30002 messageBurst: 60 messageQPS: 30 projectID: e632aba927ea4ac2b575ec1603d56f10 quic: enable: false handshakeTimeout: 30 readDeadline: 15 server: 192.168.19.139:10001 writeDeadline: 15 rotateCertificates: true tlsCaFile: /etc/kubeedge/ca/rootCA.crt tlsCertFile: /etc/kubeedge/certs/server.crt tlsPrivateKeyFile: /etc/kubeedge/certs/server.key token: 1f872fbcc3a7d5c17585b337d44c198799f42d7ec0d71dace046317aea98482b.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NzcyMjQzNjR9.TpK0L-aDrEHnTaWjN6SQA_-cQCQqp5UO3VgZfNWlxNo websocket: enable: true handshakeTimeout: 30 readDeadline: 15 server: 192.168.19.133:30000 writeDeadline: 15 edgeStream: enable: false handshakeTimeout: 30 readDeadline: 15 server: 192.168.19.133:30004 tlsTunnelCAFile: /etc/kubeedge/ca/rootCA.crt tlsTunnelCertFile: /etc/kubeedge/certs/server.crt tlsTunnelPrivateKeyFile: /etc/kubeedge/certs/server.key writeDeadline: 15 edged: cniBinDir: /opt/cni/bin cniCacheDir: /var/lib/cni/cache cniConfDir: /etc/cni/net.d containerRuntime: docker dockerEndpoint: unix:///var/run/docker.sock enable: true hostnameOverride: edgenode1 imagePullProgressDeadline: 1m0s kubeConfig: /etc/kubeedge/config/kubeconfig masterServiceNamespace: default maxPerPodContainerCount: 1 minimumGCAge: 0s networkPluginMTU: 1500 nonMasqueradeCidr: 10.0.0.0/8 podSandboxImage: kubeedge/pause:3.1 registerNode: true registerNodeNamespace: default registerSchedulable: true remoteImageEndpoint: unix:///var/run/dockershim.sock remoteRuntimeEndpoint: unix:///var/run/dockershim.sock rootDirectory: /var/lib/kubelet seccompProfileRoot: /var/lib/kubelet/seccomp tailoredKubeletConfig: address: 127.0.0.1 cgroupDriver: cgroupfs cgroupsPerQOS: true configMapAndSecretChangeDetectionStrategy: Get containerLogMaxFiles: 5 containerLogMaxSize: 10Mi contentType: application/json cpuCFSQuota: true cpuCFSQuotaPeriod: 100ms cpuManagerPolicy: none cpuManagerReconcilePeriod: 10s enableControllerAttachDetach: true enableDebugFlagsHandler: true enableDebuggingHandlers: true enableProfilingHandler: true enableServer: false enableSystemLogHandler: true enforceNodeAllocatable: - pods eventBurst: 10 eventRecordQPS: 5 evictionHard: imagefs.available: 15% memory.available: 100Mi nodefs.available: 10% nodefs.inodesFree: 5% evictionPressureTransitionPeriod: 5m0s failSwapOn: false fileCheckFrequency: 20s hairpinMode: promiscuous-bridge healthzBindAddress: 127.0.0.1 healthzPort: 10248 httpCheckFrequency: 20s imageGCHighThresholdPercent: 80 imageGCLowThresholdPercent: 40 imageMinimumGCAge: 2m0s iptablesDropBit: 15 iptablesMasqueradeBit: 14 kubeAPIBurst: 10 kubeAPIQPS: 5 logging: format: text makeIPTablesUtilChains: true maxOpenFiles: 1000000 maxPods: 110 memoryManagerPolicy: None memorySwap: {} memoryThrottlingFactor: 0.8 nodeLeaseDurationSeconds: 40 nodeStatusMaxImages: 50 nodeStatusReportFrequency: 5m0s nodeStatusUpdateFrequency: 10s oomScoreAdj: -999 podPidsLimit: -1 readOnlyPort: 10350 registryBurst: 10 registryPullQPS: 5 resolvConf: /etc/resolv.conf runtimeRequestTimeout: 2m0s seccompDefault: false serializeImagePulls: true shutdownGracePeriod: 0s shutdownGracePeriodCriticalPods: 0s streamingConnectionIdleTimeout: 4h0m0s syncFrequency: 1m0s topologyManagerPolicy: none topologyManagerScope: container volumePluginDir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec/ volumeStatsAggPeriod: 1m0s eventBus: enable: true eventBusTLS: enable: false tlsMqttCAFile: /etc/kubeedge/ca/rootCA.crt tlsMqttCertFile: /etc/kubeedge/certs/server.crt tlsMqttPrivateKeyFile: /etc/kubeedge/certs/server.key mqttMode: 2 mqttPassword: "" mqttPubClientID: "" mqttQOS: 0 mqttRetain: false mqttServerExternal: tcp://127.0.0.1:1883 mqttServerInternal: tcp://127.0.0.1:1884 mqttSessionQueueSize: 100 mqttSubClientID: "" mqttUsername: "" metaManager: contextSendGroup: hub contextSendModule: websocket enable: true metaServer: enable: false server: 127.0.0.1:10550 tlsCaFile: /etc/kubeedge/ca/rootCA.crt tlsCertFile: /etc/kubeedge/certs/server.crt tlsPrivateKeyFile: /etc/kubeedge/certs/server.key remoteQueryTimeout: 60 serviceBus: enable: false port: 9060 server: 127.0.0.1 timeout: 60
systemctl restart edgecore.service
//如果需要可以查看日志
journalctl -u edgecore.service -f -n 200
//可以看到新增的一个edge的边缘节点
kubectl get nodes
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。