• 如何进行华为云主机创建?
    # coding: utf-8import argparseimport jsonimport yamlfrom huaweicloudsdkcore.auth.credentials import BasicCredentialsfrom huaweicloudsdkecs.v2.region.ecs_region import EcsRegionfrom huaweicloudsdkcore.exceptions import exceptionsfrom huaweicloudsdkecs.v2 import *def createserver(name,imageid): try: request = CreateServersRequest() rootVolumeServer = PrePaidServerRootVolume( volumetype="SSD" ) listNicsServer = [ PrePaidServerNic( subnet_id="ecf996a0-bf3e-4521-bbfd-3f70963cc23b" ) ] serverbody = PrePaidServer( image_ref=imageid, flavor_ref="ac7.2xlarge.2", name=name, vpcid="518f3932-5828-4da4-8eab-0c8bf2e42dda", nics=listNicsServer, root_volume=rootVolumeServer ) request.body = CreateServersRequestBody( server=serverbody ) response = client.create_servers(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)def getserverbyname(name): try: request = ListServersDetailsRequest() request.name = name response = client.list_servers_details(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)def getAllServers(): try: request = ListServersDetailsRequest() response = client.list_servers_details(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)def getServersIdByName(name): try: request = ListCloudServersRequest() request.name = name response = client.list_cloud_servers(request) print(response.to_dict()['servers']) return response.to_dict()['servers'][0]['id'] except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)def deleteServer(serverid): try: request = DeleteServersRequest() listServersbody = [ ServerId( id=serverid ) ] request.body = DeleteServersRequestBody( servers=listServersbody ) response = client.delete_servers(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = "" sk = "" credentials = BasicCredentials(ak, sk) client = EcsClient.new_builder() \ .with_credentials(credentials) \ .with_region(EcsRegion.value_of("cn-north-9")) \ .build() # createserver('test','6288ab88-3b7c-4320-9554-ad68a53eebb6') # 这里写命令的映射关系,和openstack的provier一样103行之前所有的代码都是从华为云的apiexplorer里找出来的 parser = argparse.ArgumentParser(description='ECS Manager for Huawei Cloud') subparsers = parser.add_subparsers(dest='command') # Create ECS parser_create = subparsers.add_parser('create', help='Create an ECS instance') parser_create.add_argument('-i', '--input', type=json.loads, required=True,help='JSON formatted input for ECS details') # Get ECS by name parser_get = subparsers.add_parser('get', help='Get details of an ECS instance by name') parser_get.add_argument('-n', '--name', type=str, required=True, help='Name of the ECS instance') parser_get.add_argument('-o', '--output', type=str, help='Output file path (JSON format)') # Get all ECS instances parser_getall = subparsers.add_parser('getall', help='Get details of all ECS instances') parser_getall.add_argument('-o', '--output', type=str, help='Output file path (YAML format)') # Delete ECS by name parser_delete = subparsers.add_parser('delete', help='Delete an ECS instance by name') parser_delete.add_argument('-n', '--name', type=str, required=True, help='Name of the ECS instance') args = parser.parse_args() if args.command == 'create': server = createserver(args.input['name'],args.input['image']) if server: server = getserverbyname(args.input['name']) print(json.dumps(server.to_dict(), indent=2)) elif args.command == 'get': server = getserverbyname(args.name) if server: server_info = server.to_dict() if args.output: print('write file') with open(args.output, 'w') as f: json.dump(server_info, f, indent=2) else: print(json.dumps(server_info, indent=2)) else: print(f"ECS instance with name {args.name} not found.") elif args.command == 'getall': print('get all servers') servers = getAllServers() servers_info = [server.to_dict() for server in servers] if args.output: with open(args.output, 'w') as f: yaml.dump(servers_info, f, default_flow_style=False) else: print(yaml.dump(servers_info, default_flow_style=False)) elif args.command == 'delete': id = getserverbyname(args.name) deleteServer(id) else: parser.print_help()以上是华为云主机创建过程,请各位批评指正。我爱吃螺蛳粉
  • [热门活动] 融合创新,智领未来 | 2024华为云开源开发者论坛云原生精彩回顾
    12月7日,2024华为云开源开发者论坛在上海顺利召开。本届论坛面向用户企业、生态伙伴、个人和高校开发者,开展主论坛、云原生、开源共创、大前端四大论坛,共启云上创新和价值裂变。云原生与AI成为本次论坛中的热门话题,来自CNCF、小红书、B站、华为云、DaoCloud、多比特、京东等技术大咖齐聚上海,共享KubeEdge、Volcano、Karmada、openGemini、Kmesh、Kuasar、openEuler、Sermant等项目技术的生产实践和创新成果,共探云原生社区合作与未来发展无限可能。开放协作,共创云原生 × AI繁荣生态华为云开源业务总经理邓明昆在论坛上发表《开放协作,共创云原生繁荣生态》演讲。他表示,云原生的商业价值和技术价值已经已经获得市场和社区的广泛认同,华为云作为云原生生态的重要参与者,将持续开放协作,和开发者一起共创云原生繁荣生态。会上,Kmesh Orion 子项目重磅亮相,持续构建内存安全、高性能的云原生数据面。引领云原生技术创新,华为云云原生一路生花。今年,KubeEdge成为CNCF首个云原生边缘计算毕业项目,openGemini、Sermant正式成为CNCF官方项目,Karmada、Volcano海内外多行业代表用户大规模生产落地,Kmesh创新引领Sidecarless服务网格发展,Kuasar 1.0 实现LLM高效开发与灵活部署重塑,推动云原生与AI融合发展。▲ 华为云开源业务总经理邓明昆云原生已成为企业数字化转型的重要基石,随着人工智能的高速发展,云原生和 AI 的融合也正在智能应用和行业场景中展现出更大的潜力。主论坛上,CNCF中国区总监、LF亚太区战略总监Keith Chan分享了开源发展趋势及当前热门的Cloud Native AI。他提到,AI开发者正与云原生开发者呈融合之势,Cloud Native AI即在云原生基础设施上部署和应用AI。在对最终用户的调研中发现,超半数企业在 AI 部署中应用云原生技术,涵盖公有云、私有云及混合云。在迈向CNAI的进程中,云原生生态系统为在云中运行AI工作负载拥有更好体验铺平了道路,有力地支持了GPU共享,对加速云原生AI发展提供了有力的技术支持。▲ CNCF中国区总监、LF亚太区战略总监Keith Chan在《打破算力边界,云原生加速AI应用创新》主题分享中,华为云云原生开源负责人、CNCF技术监督委员会(TOC)委员王泽锋指出,AI应用创新高速发展对算力提出了更高要求,云原生统一算力平台,有效整合资源,实现高效的管理与调度,已成为AI的最佳底座,而统一作业编排和算力调度是平台能力的关键。他详细阐述了基于 Karmada 和 Volcano 的统一算力编排调度方案,包括作业抽象、Gang 调度、装箱调度、统一资源管理、故障迁移等功能,这些云原生能力为AI应用提供了稳定、高效的运行环境,推动AI创新发展。▲ 华为云云原生开源负责人、CNCF技术监督委员会(TOC)委员王泽锋融合创新,智能未来,云原生论坛大咖齐聚小红书容器技术专家、云原生资源效能与应用平台负责人熊峰带来《Karmada助力小红书打造混合云多集群架构》演讲分享。随着业务的飞速发展,小红书内部K8s集群的规模和数量都在快速增长,集群和资源管理难度急剧增大,小红书通过引入 Karmada 多集群方案,打造面向应用的统一平台入口,提升应用跨集群分发与弹性能力,做好应用跨集群调度,高效管理多云基础设施。▲ 小红书容器技术专家、云原生资源效能与应用平台负责人熊峰Bilibili云原生资深研发工程师王凯发表《哔哩哔哩在视频转码场景下基于Volcano的落地实践》演讲。他介绍了为什么选型Volcano并细致讲解了基于 Volcano 的联邦化离线平台介绍和转码场景对 Volcano 做的高吞吐改造。当前 B 站转码任务已经 100% 由 Volcano 调度。借助 Volcano ,B站将批任务处理能力下沉到了平台,可供其他类似场景复用,此外也和其他场景拉齐了调度器。当前 B 站内部 AI、大数据、转码已经都统一了调度器。▲ Bilibili云原生资深研发工程师王凯KubeEdge作为今年新晋的CNCF毕业级项目,也在本次云论坛上趁热给与会项目和开发者们带来了社区治理经验分享,KubeEdge TSC两位专家——华为云高级软件工程师徐飞,道客首席运营官张红兵联合发表《CNCF毕业项目KubeEdge经验分享及行业实践》演讲。KubeEdge自2018年开源以来,一直秉持开源开放的治理理念,在社区开发、社区治理、社区用户采纳等方面都取得重大的进展。成功从CNCF毕业,标志着项目的发展进入成熟的新阶段。▲ KubeEdge TSC,华为云高级软件工程师徐飞,道客首席运营官张红兵华为云数据库技术专家 & openGemini社区Maintainer 范祥从社区技术融合创新的角度,带来《openGemini 与 KubeEdge:探索云边协同的高效时序数据治理方案》分享。他指出,当前,物联网和车联网领域的企业普遍将数据直接传输至云端,这导致了数据流转环节增多,数据处理效率问题变得尤为紧迫。为了应对这一挑战,openGemini携手KubeEdge和社区合作伙伴,致力于打造基于KubeEdge平台的云边协同解决方案,旨在为用户提供简单、便捷且高效的数据处理能力。▲ 华为云数据库技术专家 & openGemini社区Maintainer 范祥华为云Grid可靠性首席技术专家刘翔,Istio社区Steering Committee委员、Kmesh Maintainer徐中虎介绍了《服务网格的未来:Kmesh的设计思想与演进方向》。Kmesh采用eBPF将L4治理下沉内核,配合安全、稳定、可靠的中心式L7代理,将高性能、轻量发挥到极致。Kmesh Orion作为内存安全、高性能的云原生数据面,具备丰富的L7流量治理特性,可以对当前Kmesh的L4流量治理能力进行有效补充,与Kmesh组合将在安全、高性能、低开销、极简运维等方面形成独特的竞争优势。▲ 华为云Grid可靠性首席技术专家刘翔,Istio社区Steering Committee委员,Kmesh Maintainer徐中虎华为云容器基础设施架构师冯绍宝,华为高级工程师、openEuler sig-cloudnative Maintainer徐学鹏介绍了Kuasar新型轻量化容器沙箱的探索和实践。单一容器沙箱很难同时满足安全、通用和资源效率这3个特性。Kuasar提出一套Sandbox管理框架,通过简化架构,抽象接口,配合轻量级容器引擎iSulad,提供了丰富的沙箱类型支持,可大幅沙箱容器的启动速度和资源效率。iSulad+Kuasar将在Serverless、AI、机密容器等场景持续演进,在云原生时代发挥更大的作用。▲ 华为云容器基础设施架构师冯绍宝,华为高级工程师,openEuler sig-cloudnative Maintainer冯学鹏多比特基础架构组负责人陈志军发表《小游戏出海场景下基于Sermant的云原生微服务架构演进》演讲。他介绍了在中国小游戏企业出海渐成趋势之际面临的挑战及对微服务架构的选型过程。Sermant具备高性能、资源占用少、代码0侵入等优势,全面的类隔离机制实现0类冲突,且提供更丰富、更灵活的服务治理功能解耦,微服务运行时动态挂载:服务0中断。多比特在基于Sermant的实践中,探索出了一条保证业务稳定和成本可控的道路。▲ 多比特基础架构组负责人陈志军在论坛期间的云原生趋势谈主题圆桌中,CNCF中国区总监、LF亚太区战略总监Keith Chan,华为云云原生开源负责人、CNCF TOC王泽锋,道客首席运营官、KubeEdge TSC张红兵,京东高级算法工程师王龙辉,华为云高级软件工程师任洪彩进行了云原生趋势深度探讨,共研开源跨社区合作、用户社区合作以及云原生与AI未来发展等话题。▲ 圆桌对话:云原生趋势谈让每一位开发者都成为决定性的力量。在大会主论坛上,来自Karmada、Volcano、KubeEdge、openGemini等社区的多位云原生社区核心贡献者,荣获年度杰出开源开发者奖项。该奖项用于致谢开发者们在华为云开源开发者生态中的协作贡献和卓越价值。▲ 年度杰出开源开发者作为全球云原生生态的长期参与者与贡献者,华为云深耕云原生技术创新,是CNCF唯一的中国创始成员,拥有CNCF多个项目技术委员会、治理委员会成员及核心Maintainer席位,并在2024年获得了全球顶级开源组织CNCF中国本土唯一TOC委员席位。坚持开源创新,驱动产业升级,随着企业用云的不断深入,华为云持续创研业界领先的云原生产品方案,连续八次中国容器软件市场份额No.1,分布式云原生UCS、云容器引擎CCE、Serverless容器CCE Autopilot和CCI等代表产品引领全行业智能化发展趋势,为企业数智化转型提供强大动力。融合创新,智领未来。开源社区不仅仅在各自的技术领域中加深探索创新,也在跨社区的应用合作与融合发展中不断拓宽可能性。本次华为云开源开发者论坛云原生分论坛,为用户和开发者们带来了多项目、多领域的行业用户实践经验和技术创新成果分享,而成熟发展的云原生生态系统也正在加速引领各行各业迈向智能未来。更多云原生技术动向关注容器魔方
  • [技术干货] 2024年11月 FAQ—云计算等其他(问题求助) 总结-2024.11
      2024年11月 FAQ—云计算等其他(问题求助) 总结-2024.11  【云计算】基础设施即服务 (IaaS):如何在不同地区之间迁移数据?  https://bbs.huaweicloud.com/forum/thread-0217168226632705035-1-1.html   【云计算】基础设施即服务 (IaaS):如何选择正确的存储类型?  https://bbs.huaweicloud.com/forum/thread-0296168140237186039-1-1.html   【云计算】基础设施即服务 (IaaS):如何实现容灾备份?  https://bbs.huaweicloud.com/forum/thread-0217168054228372027-1-1.html   【云计算】基础设施即服务 (IaaS): 虚拟网络与子网的作用是什么?  https://bbs.huaweicloud.com/forum/thread-02109167966489780015-1-1.html   为什么树莓派5b显示禁止连接  https://bbs.huaweicloud.com/forum/thread-0263167878118310014-1-1.html   【云计算】基础设施即服务 (IaaS): 如何设置自动扩展(Auto Scaling)?  https://bbs.huaweicloud.com/forum/thread-02109167620977883002-1-1.html   【云计算】基础设施即服务 (IaaS): 如何配置负载均衡器?  https://bbs.huaweicloud.com/forum/thread-0231167535045832019-1-1.html   【基础设施即服务 (IaaS)】什么是块存储与对象存储?  https://bbs.huaweicloud.com/forum/thread-02127167449000488011-1-1.html   【基础设施即服务 (IaaS)】怎样管理虚拟机实例?   https://bbs.huaweicloud.com/forum/thread-02127167362518074006-1-1.html    如何选择适合的 IaaS 提供商?  https://bbs.huaweicloud.com/forum/thread-0229167275974648009-1-1.html   aws 已创建 alb ingress 域名 无法访问,如何查看 ingress controller 情况   https://bbs.huaweicloud.com/forum/thread-02127166937116553016-1-1.html   websocat -v --insecure wss://xxxxx 无法连接   https://bbs.huaweicloud.com/forum/thread-0257166935611082018-1-1.html   C#如何实现:Modbus通讯监控暖房温度PID控制  https://bbs.huaweicloud.com/forum/thread-0210166930372240018-1-1.html   美区facebook限制发送好友请求。有人知道怎么解决这个问题吗  https://bbs.huaweicloud.com/forum/thread-02127166870753492014-1-1.html    ansys fluent计算闪退  https://bbs.huaweicloud.com/forum/thread-0266166843768681014-1-1.html   如何在proteus使用sounder设置每次按键时扬声器会有提示声  https://bbs.huaweicloud.com/forum/thread-0231166781739432016-1-1.html   调试无法使用,定义更改  https://bbs.huaweicloud.com/forum/thread-0289166758250387012-1-1.html   脉冲信号有高电平和低电平,那么负脉冲有负电压吗?  https://bbs.huaweicloud.com/forum/thread-0231166699780052012-1-1.html   随机森林模型不同年份影响因素分析  https://bbs.huaweicloud.com/forum/thread-0266166697120887009-1-1.html    提取CMU- Mosei数据集的特征  https://bbs.huaweicloud.com/forum/thread-0266166498654785006-1-1.html   网页拖进ftp资源管理器站点以后打开是浏览器默认界面   https://bbs.huaweicloud.com/forum/thread-0257166412254834002-1-1.html   打开游戏出现这个进不去。求解   https://bbs.huaweicloud.com/forum/thread-02127166326594269013-1-1.html   system x3610支持ESX7.0系统安装吗?IBM system x3610支持ESX7.0系统安装吗?  https://bbs.huaweicloud.com/forum/thread-0216166325288704024-1-1.html   海思Hi3816芯片在开发过程中与单片机有什么不同   https://bbs.huaweicloud.com/forum/thread-0220166268614811015-1-1.html    dolphinschedler部署完成 删除修改无反应  https://bbs.huaweicloud.com/forum/thread-0252166259675728017-1-1.html    如何实现 除法器设计实例-设计目标   https://bbs.huaweicloud.com/forum/thread-0257166259605659022-1-1.html   本地与多个区域云服务器互联互通,如何解决?  https://bbs.huaweicloud.com/forum/thread-0220166259404985012-1-1.html  关于银河麒麟V10服务器操作系统虚拟机中FTP服务器的问题  https://bbs.huaweicloud.com/forum/thread-0216166239065295018-1-1.html    关于sap登录问题解决  https://bbs.huaweicloud.com/forum/thread-0255166238984096020-1-1.html  用友GRP-U8卡片登记簿问题  https://bbs.huaweicloud.com/forum/thread-0257166170273793019-1-1.html   vercel注册时遇到问题  https://bbs.huaweicloud.com/forum/thread-0255166170192717016-1-1.html   facescrub数据集是有什么特点吗?  https://bbs.huaweicloud.com/forum/thread-02127166170118839012-1-1.html    本帖内容会持续刷新维护和新增问答,如您有本类型问题或问题仍无法解决,欢迎留言交流! 
  • [热门活动] 【话题交流】云计算有哪些可以探讨的未来发展方向?
    云计算有哪些可以探讨的未来发展方向?欢迎大佬们在帖子下留言讨论!!!
  • [常见问题汇总帖] 【云计算】基础设施即服务 (IaaS):如何在不同地区之间迁移数据?
    华为云 如何在不同地区之间迁移数据?
  • [技术干货] 2024华为云开源开发者论坛项目抢鲜看|Kmesh: 监控指标和访问日志功能详解
    Kmesh 是内核原生Sidecarless服务网格数据平面。它借助 "eBPF "和 "可编程内核",将流量治理下沉到操作系统内核,大大的降低了服务网格的资源开销和网络延迟。通过eBPF,流量数据可以直接在内核中获取,并且能够使用 "bpf map"将数据传递到用户空间。Kmesh使用这些数据构建监控指标和访问日志。▍如何获取原始数据在内核中,可以直接获取socket携带的流量信息。bpf_tcp_sock 中携带的数据如下:struct bpf_tcp_sock { __u32 snd_cwnd; /* Sending congestion window */ __u32 srtt_us; /* smoothed round trip time << 3 in usecs */ __u32 rtt_min; __u32 snd_ssthresh; /* Slow start size threshold */ __u32 rcv_nxt; /* What we want to receive next */ __u32 snd_nxt; /* Next sequence we send */ __u32 snd_una; /* First byte we want an ack for */ __u32 mss_cache; /* Cached effective mss, not including SACKS */ __u32 ecn_flags; /* ECN status bits. */ __u32 rate_delivered; /* saved rate sample: packets delivered */ __u32 rate_interval_us; /* saved rate sample: time elapsed */ __u32 packets_out; /* Packets which are "in flight" */ __u32 retrans_out; /* Retransmitted packets out */ __u32 total_retrans; /* Total retransmits for entire connection */ __u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn * total number of segments in. */ __u32 data_segs_in; /* RFC4898 tcpEStatsPerfDataSegsIn * total number of data segments in. */ __u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut * The total number of segments sent. */ __u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut * total number of data segments sent. */ __u32 lost_out; /* Lost packets */ __u32 sacked_out; /* SACK'd packets */ __u64 bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived * sum(delta(rcv_nxt)), or how many bytes * were acked. */ __u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked * sum(delta(snd_una)), or how many bytes * were acked. */ __u32 dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups * total number of DSACK blocks received */ __u32 delivered; /* Total data packets delivered incl. rexmits */ __u32 delivered_ce; /* Like the above but only ECE marked packets */ __u32 icsk_retransmits; /* Number of unrecovered [RTO] timeouts */ };注意: 上述数据并没完全用于监控指标和访问日志功能。Kmesh将在后续的开发中逐步补充这些指标。现阶段使用的数据有:struct tcp_probe_info { __u32 type; struct bpf_sock_tuple tuple; __u32 sent_bytes; __u32 received_bytes; __u32 conn_success; __u32 direction; __u64 duration; // ns __u64 close_ns; __u32 state; /* tcp state */ __u32 protocol; __u32 srtt_us; /* smoothed round trip time << 3 in usecs */ __u32 rtt_min; __u32 mss_cache; /* Cached effective mss, not including SACKS */ __u32 total_retrans; /* Total retransmits for entire connection */ __u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn * total number of segments in. */ __u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut * The total number of segments sent. */ __u32 lost_out; /* Lost packets */ };除了这些socket携带的数据外,Kmesh通过socket_storage在建立链接时存储临时数据。当链接关闭时,从之前存储的临时数据中获取链接持续时间等数据。▍数据处理Kmesh在内核中获取了来自链接的数据后,会通过ringbuf将数据传递给用户态。Kmesh在用户态将ringbuf的数据解析之后,根据这些数据中携带的源服务和目标服务信息更新metricController中的缓存和构建metricLabels。构建的metricLabels有workload粒度的也有service粒度的。但workload粒度的监控指标最多是集群中pod数量的平方,因此Kmesh提供一个启动开关,使用户能够按需启用监控指标功能和访问日志功能。namespacedhost := "" for k, portList := range dstWorkload.Services { for _, port := range portList.Ports { if port.TargetPort == uint32(dstPort) { namespacedhost = k break } } if namespacedhost != "" { break } }建立工作负载粒度的度量和服务粒度的度量metricLabels后,更新缓存。每5秒钟,监控指标信息都会通过Prometheus API更新到Prometheus中。在处理指标时,会一起生成访问日志。每次链接关闭时,都会将生成的Accesslog打印到Kmesh的日志中。Kmesh监控指标功能和访问日志功能的整体架构图如下所示:指标细节现阶段Kmesh L4层监控的指标如下:工作负载粒度:NameDescribekmesh_tcp_workload_connections_opened_total源工作负载和目标工作负载之间总共建立了多少次链接kmesh_tcp_workload_connections_closed_total源工作负载和目标工作负载之间总共关闭了多少次链接kmesh_tcp_workload_received_bytes_total目标工作负载接收到了多少的数据kmesh_tcp_workload_sent_bytes_total源工作负载发送了多少的数据kmesh_tcp_workload_conntections_failed_total源工作负载和目标工作负载之间建立链接失败了多少次服务粒度:NameDescribekmesh_tcp_connections_opened_total源工作负载和目标服务之间总共建立了多少次链接kmesh_tcp_connections_closed_total源工作负载和目标服务之间总共关闭了多少次链接kmesh_tcp_received_bytes_total目标服务接收到了多少的数据kmesh_tcp_sent_bytes_total源工作负载发送了多少的数据kmesh_tcp_conntections_failed_total源工作负载和目标服务之间建立链接失败了多少次监控指标例子:kmesh_tcp_workload_received_bytes_total{connection_security_policy="mutual_tls",destination_app="httpbin",destination_canonical_revision="v1",destination_canonical_service="httpbin",destination_cluster="Kubernetes",destination_pod_address="10.244.0.11",destination_pod_name="httpbin-5c5944c58c-v9mlk",destination_pod_namespace="default",destination_principal="-",destination_version="v1",destination_workload="httpbin",destination_workload_namespace="default",reporter="destination",request_protocol="tcp",response_flags="-",source_app="sleep",source_canonical_revision="latest",source_canonical_service="sleep",source_cluster="Kubernetes",source_principal="-",source_version="latest",source_workload="sleep",source_workload_namespace="default"} 231也能够通过prometheus dashboard查看监控指标。具体步骤参考Kmesh可观测性文档。现阶段Kmesh访问日志展示的字段如下:NameDescribesrc.addr请求的源地址和端口src.workload源工作负载名称src.namespace源工作负载所在的namespacedst.addr请求的目标地址和端口dst.service目标服务的域名dst.workload目标工作负载的名称dst.namespace目标工作负载的命名空间direction流量流向,OUTBOUND表示从节点流出,INBOUND表示从流入节点sent_bytes本次链接发送的数据量received_bytes本次链接接收的数据量duration本次链接的持续时间Accesslog Result:accesslog: 2024-09-14 08:19:26.552709932 +0000 UTC src.addr=10.244.0.17:51842, src.workload=prometheus-5fb7f6f8d8-h9cts, src.namespace=istio-system, dst.addr=10.244.0.13:9080, dst.service=productpage.echo-1-27855.svc.cluster.local, dst.workload=productpage-v1-8499c849b9-bz9t9, dst.namespace=echo-1-27855, direction=INBOUND, sent_bytes=5, received_bytes=292, duration=2.733902ms▍SummaryKmesh直接从套接字获取流量数据,并将其作为ringbuf传递到用户空间,以生成监控指标和访问日志。避免在用户空间拦截流量并以本地方式获取指标。定期批量更新用户空间中的指标,避免在大流量时增加网络延迟。随后,我们还将开发跟踪功能,以补充 Kmesh 的可观测能力。欢迎感兴趣的同学加入Kmesh开源社区!12月7日,Kmesh技术专家将在2024华为云开源开发者论坛上带来《服务网格的未来:Kmesh的设计思想与演进方向》技术分享及重磅发布!添加小助手k8s2222,报名领票参会!
  • [问题求助] 【云计算】基础设施即服务 (IaaS):如何选择正确的存储类型?
    如何选择正确的存储类型?
  • [常见问题汇总帖] 【云计算】基础设施即服务 (IaaS):如何实现容灾备份?
    华为云如何实现容灾备份?
  • [热门活动] 2024华为云开源开发者论坛完整议程揭晓,邀您共赴技术盛会!
    开放创新,释放云上数字生产力。12月7日,2024华为云开源开发者论坛将于上海举办。本届论坛面向生态合作伙伴、企业、个人和高校开发者,设置主论坛、云原生、开源共创、大前端四大论坛,帮助开发者使用开源链接鲲鹏、昇腾根生态和华为云生态,实现高效创新和价值裂变。2024华为云开源开发者论坛云原生专场汇聚 KubeEdge、Volcano、Karmada、Kmesh、openGemini、Sermant、OpenTiny、Kuasar 等技术大咖,邀您共探前沿技术,共领智能未来!完整议程已揭晓,欢迎报名参会 https://hdxu.cn/mitm
  • [常见问题汇总帖] 【云计算】基础设施即服务 (IaaS): 虚拟网络与子网的作用是什么?
    虚拟网络与子网的作用是什么?
  • [技术干货] KubeEdge边缘设备管理系列(一):基于物模型的设备管理API设计与实现
    作者:王彬丞、杨志佳、刘家伟随着万物互联时代快速到来,5G网络普及导致边缘设备产生的数据量快速增长。普通的边缘设备计算能力不足,因此传统方法会将边缘侧数据集中汇聚到云端数据中心进行处理,容易对响应实时性、网络稳定性以及数据安全性产生挑战。为满足用户在大规模设备场景中更高的可用性需求,KubeEdge Device-IoT在1.12版本推出设备管理框架(Device Management Interface,DMI)。DMI整合设备管理接口,将管理面和业务面数据解耦,优化边缘计算场景下的设备管理能力,打造基于云原生技术的设备数字孪生管理平台。在 1.15 版本中,我们根据边缘设备管理的用户需求迭代更新 v1beta1 版本的设备管理  API,并以此为基础完善 DMI 数据面功能,承载于南向的 Mapper 开发框架 Mapper-Framework 中。Mapper-Framework 提供了全新的 Mapper 自动生成框架,框架中集成了 DMI 设备管理面与数据面能力,能够自动生成 Mapper 工程,用户只需实现其中的设备驱动的功能即可使用 Mapper 管理边缘设备,简化用户设计开发 Mapper 的复杂度,提升开发效率。针对新版本 Device-IoT 领域的更新,我们计划推出一系列的文章对这些特性进行详细的介绍,大致的文章大纲为:基于物模型的设备管理 API 设计与实现DMI 数据面能力设计与实现Mapper 开发框架 Mapper-Framework 设计与实现如何使用 Mapper 完成视频流数据处理如何使用 Mapper 实现设备数据写入如何从头开发一个 Mapper(以 modbus 为例) 本篇文章是系列文章的第一篇,主要介绍基于物模型的设备管理 API。    基于物模型的设备管理 API  为适应用户需求,在 v1.15.0 版本中,KubeEdge SIG Device-IoT 提出基于物模型的设备管理 API,将 Device Model 与 Device Instance从 v1alpha2 版本升级为 v1beta1 版本。新版本的设备管理 API 能够更全面的描述物理设备,新增了边缘设备数据处理的相关字段,能够适配 DMI 数据面能力增强功能。北向设备  API 结合南向的 DMI 接口,实现设备管理与设备数据处理,API 的主要更新包括:▍1. Device ModelDevice Model 用以描述一类边缘设备共同的设备属性。按照物模型的定义,Device Model 中新增了设备属性描述、设备属性类型、设备属性取值范围、设备属性单位等字段,如下图所示:// ModelProperty describes an individual device property / attribute like temperature / humidity etc. type ModelProperty struct { // Required: The device property name. // Note: If you need to use the built-in stream data processing function, you need to define Name as saveFrame or saveVideo Name string `json:"name,omitempty"` // The device property description. // +optional Description string `json:"description,omitempty"` // Required: Type of device property, ENUM: INT,FLOAT,DOUBLE,STRING,BOOLEAN,BYTES,STREAM Type PropertyType `json:"type,omitempty"` // Required: Access mode of property, ReadWrite or ReadOnly. AccessMode PropertyAccessMode `json:"accessMode,omitempty"` // +optional Minimum string `json:"minimum,omitempty"` // +optional Maximum string `json:"maximum,omitempty"` // The unit of the property // +optional Unit string `json:"unit,omitempty"` }上图展示了 Device Model 的核心 ModelProperty 字段,其中 Type 字段定义该属性的数据类型,AccessMode 定义该属性的访问方式,包括读写和只读两种。当访问方式设置为只读时,Mapper 会直接返回采集到的设备数据,反之当设置为读写后,Mapper 会对采集到的设备数据进行归一化等处理后再返回。Minimum 与 Maximum 则定义了设备属性的最大最小值,Unit 字段定义了设备属性的单位。下图展示了一个 Device Model 配置文件的示例:apiVersion: devices.kubeedge.io/v1beta1 kind: DeviceModel metadata: name: beta1-model spec: properties: - name: temp # define device property description: beta1-model type: INT # date type of device property accessMode: ReadWrite maximum: "100" # range of device property (optional) minimum: "1" unit: "Celsius" # unit of device property protocol: modbus # protocol for device, need to be same with device instance▍2. Device Instance一个 Device Instance 代表一个实际的设备对象。v1beta1 版本中,Device Instance 中内置的协议配置全部移除,包括 Modbus、OPC-UA、Bluetooth 等。用户可以通过可扩展的 Protocol 配置来设置设备协议,能够实现任何协议的设备接入。Modbus、OPC-UA、Bluetooth 等内置协议的 Mapper 仍会保留在 Mappers-go 仓库中,同时也会不断增加其他协议的内置 Mapper。type ProtocolConfig struct { // Unique protocol name // Required. ProtocolName string `json:"protocolName,omitempty"` // Any config data // +optional // +kubebuilder:validation:XPreserveUnknownFields ConfigData *CustomizedValue `json:"configData,omitempty"` } type CustomizedValue struct { Data map[string]interface{} `json:"-"` }此外,为增强 DMI 数据面功能,本次更新在 Device Instance 的设备属性中增加了设备数据处理的相关配置,例如设备上报频率、数据推送频率、属性是否上报云端、设备数据推送方式,如下图所示。type DeviceProperty struct { ... // Define how frequent mapper will report the value. // +optional ReportCycle int64 `json:"reportCycle,omitempty"` // Define how frequent mapper will collect from device. // +optional CollectCycle int64 `json:"collectCycle,omitempty"` // whether be reported to the cloud ReportToCloud bool `json:"reportToCloud,omitempty"` // PushMethod represents the protocol used to push data, // please ensure that the mapper can access the destination address. // +optional PushMethod *PushMethod `json:"pushMethod,omitempty"` }ReportCycle 字段定义了 Mapper 向用户数据库、用户应用推送数据的频率;CollectCycle 字段定义了 Mapper 向云端上报数据的频率;ReportToCloud 字段定义了 Mapper 采集到的设备数据是否需要上报云端;PushMethod 字段定义了 Mapper 推送设备数据的方式。目前提供 HTTP、MQTT 以及 OpenTelemetry 等方式向用户应用推送数据,并内置集成 InfluxDB、MySQL、Redis、TDengine 数据库。用户能够通过配置文件控制Mapper 向用户应用、用户数据库中定时推送设备数据,也能够通过 API 主动拉取设备数据,实现设备数据处理方式的多样化,相比于将所有数据推送至云端再行处理的传统方法,能够有效减少云边通信阻塞的风险。下图展示了一个 Device Instance 配置文件的示例:apiVersion: devices.kubeedge.io/v1beta1 kind: Device ... spec: properties: - name: temp collectCycle: 2000 # The frequency of reporting data to cloud, 2 seconds reportCycle: 2000 # The frequency of data push to user applications or databases, 2 seconds reportToCloud: true # Decide whether device data needs to be pushed to the cloud pushMethod: mqtt: # Define the MQTT config to push device data to user app address: tcp://127.0.0.1:1883 topic: temp qos: 0 retained: false visitors: # Define the configuration required by the mapper to access device properties (e.g. register address) protocolName: modbus configData: register: "HoldingRegister" offset: 2 limit: 1 protocol: # Device protocol. The relevant configuration of the modbus protocol is defined in the example. protocolName: modbus configData: serialPort: '/dev/ttyS0' baudRate: 9600基于 v1beta1版本的设备管理 API,我们以 Kubernetes CRD 的形式将 Device Model 与 Device Instance 引入 KubeEdge 集群。如需要更多详细的信息,可以参考设备管 API 的 proposal 文件[1] 以及相关 PR[2]。在本系列的下一篇文章中,我们会对 DMI 数据面能力的支持进行详细的介绍。▍相关链接[1]  docs/proposals/device-crd-v1beta1.md:cid:link_1[2]  相关PR:device crd v1beta1 and API definition:cid:link_2【更多KubeEdge资讯推荐】玩转KubeEdge保姆级攻略——环境搭建篇玩转KubeEdge保姆级攻略——环境搭建篇《玩转KubeEdge保姆级攻略——环境搭建篇》课程主要介绍如何通过华为云服务快速搭建一套KubeEdge边缘计算开发平台及部署Sedna、EdgeMesh等KubeEdge生态组件。课程免费学习链接:cid:link_0KubeEdge社区介绍:KubeEdge是业界首个云原生边缘计算框架、云原生计算基金会(CNCF)唯一毕业级边缘计算开源项目,社区已完成业界最大规模云原生边云协同高速公路项目(统一管理10万边缘节点/50万边缘应用)、业界首个云原生星地协同卫星、业界首个云原生车云协同汽车、业界首个云原生油田项目,开源业界首个分布式协同AI框架Sedna及业界首个边云协同终身学习范式,并在持续开拓创新中。KubeEdge网站 :  https://kubeedge.ioGitHub地址 : cid:link_3Slack地址 : https://kubeedge.slack.com邮件列表 : https://groups.google.com/forum/#!forum/kubeedge每周社区例会 : https://zoom.us/j/4167237304Twitter : https://twitter.com/KubeEdge文档地址 : https://docs.kubeedge.io/en/latest/
  • [常见问题汇总帖] 【云计算】基础设施即服务 (IaaS): 如何设置自动扩展(Auto Scaling)?
    基础设施即服务 (IaaS): 如何设置自动扩展(Auto Scaling)?
  • [常见问题汇总帖] 【云计算】基础设施即服务 (IaaS): 如何配置负载均衡器?
    如何配置负载均衡器?
  • [问题求助] 【基础设施即服务 (IaaS)】什么是块存储与对象存储?
    什么是块存储与对象存储?
  • [常见问题汇总帖] 【基础设施即服务 (IaaS)】怎样管理虚拟机实例?
    怎样管理虚拟机实例?
总条数:1431 到第
上滑加载中