DevilKing's blog

冷灯看剑,剑上几分功名?炉香无需计苍生,纵一穿烟逝,万丈云埋,孤阳还照古陵

0%

原文链接

One common theme with many organizations is the need for portability across cloud providers. These teams want to deploy robust applications in multi-cloud and hybrid-cloud environments, and migrate their workloads between cloud providers without significant changes to their code.

Go Cloud is launching with blob storage, MySQL database access, runtime configuration, and an HTTP server configured with request logging, tracing, and health checking. Go Cloud offers support for Google Cloud Platform (GCP) and Amazon Web Services (AWS). We plan to work with cloud industry partners and the Go community to add support for additional cloud providers very soon

1
2
3
4
5
6
7
8
9
10
11
12
// setupBucket opens an AWS bucket.
func setupBucket(ctx context.Context) (*blob.Bucket, error) {
// Obtain AWS credentials.
sess, err := session.NewSession(&aws.Config{
Region: aws.String("us-east-2"),
})
if err != nil {
return nil, err
}
// Open a handle to s3://go-cloud-bucket.
return s3blob.OpenBucket(ctx, sess, "go-cloud-bucket")
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// setupBucket opens a GCS bucket.
func setupBucket(ctx context.Context) (*blob.Bucket, error) {
// Open GCS bucket.
creds, err := gcp.DefaultCredentials(ctx)
if err != nil {
return nil, err
}
c, err := gcp.NewHTTPClient(gcp.DefaultTransport(), gcp.CredentialsTokenSource(creds))
if err != nil {
return nil, err
}
// Open a handle to gs://go-cloud-bucket.
return gcsblob.OpenBucket(ctx, "go-cloud-bucket", c)
}

针对不同的云平台,相关的bucket的设置不同罢了。。

原理上,就是将对云的一些操作,集成到go-cloud里面去

原文链接

Concepts

Nodes:

  • Cluster: A set of machines, called nodes, that run containerized applications.
  • Node: A single virtual or physical machine that provides hardware resources.
  • Edge Node: The node which is exposed to the Internet.
  • Master Node: The node which is responsible for managing the whole cluster.

Objects:

  • Pod: A group of one or more tightly related containers. Each pod is like a logical host has its own IP and hostname.
  • PodPreset: A set of pre-defined configurations can be injected into Pods automatically.
  • Service: A load balancer of a set of Pods which selected by labels, also called Service Discovery.
  • Ingress: A revered proxy acts as an entry point to the cluster, which allows domain-based and path-based routing to different Services.
  • ConfigMap: Key-value configuration data can be mounted into containers or consumed as environment variables.
  • Secret: Similar to ConfigMap but for storing sensitive data only.
  • Volume: A ephemeral file system whose lifetime is the same as the Pod.
  • PersistentVolume: A persistent file system that can be mounted to the cluster, without being associated with any particular node.
  • PersistentVolumeClaim: A binding between a Pod and a PersistentVolume.
  • StorageClass: A storage provisioner which allows users request storages dynamically.
  • Namespace: The way to partition a single cluster into multiple virtual groups.

Controllers:

  • ReplicationController: Ensures that a specified number of Pods are always running.
  • ReplicaSet: The next-generation ReplicationController.
  • Deployment: The recommended way to deploy stateless Pods.
  • StatefulSet: Similar to Deployment but provides guarantees about the ordering and unique names of Pods.
  • DaemonSet: Ensures a copy of a Pod is running on every node.
  • Job: Creates Pods that runs to completion (exit with 0).
  • CronJob: A Job which can run at a specific time or run regularly.
  • HorizontalPodAutoscaler: Automatically scales the number of Pods based on CPU and memory utilization or custom metric targets.

Pods have following life cycles (states):

  • Pending
  • Running
  • Succeeded
  • Failed
  • Unknown

ConfigMap的作用?

关于ingress部分

Pods in Kubernetes are not reachable from outside the cluster, so you need a way to expose your Pods to the Internet. Even though you could associate Pods with a Service of the right type, i.e., NodePort or LoadBalancer, the recommended way to expose services is using Ingress. You can do a lot of different things with an Ingress, and there are many types of Ingress controllers that have different capabilities.

There are some reasons to choose Ingress over Service:

  • Service is internal load balancers and Ingress is a gateway of external access to Services
  • Service is L3 load balancer and Ingress is L7 load balancer
  • Ingress allows domain-based and path-based routing to different Services
  • It is not efficent to create a cloud provider’s load balancer for each Service you want to expose

原文链接

The main function indeed runs in its own go routine.

1
<-time.After(time.Second * 5) //Receiving from channel after 5 sec

愿为长安轻薄儿,生于开元天宝时。斗鸡走马过一世,天下兴亡两不知

做不到斗鸡走马,也只能读书学习了


本周工作:

  • 顺利提出了离职,后面就是整理交接部分的文档了
  • es部分,也算是顺利地利用bulkprocess完成相关部分的修复
  • sdk的交接文档的书写

下周工作:

  • 整理交接部分其他的文档
  • 相关日期的排定部分

也算是最终提出了提职了,算是意料之中的,心思也算是落定了,后面就是交接文档部分,以及温习新的知识部分了

关于新的知识方面,尽快地列一些提纲部分,作为复习和学习的一些计划

。。。真的是。。相当于装死了。。呵呵,没有精力来管这个事情,后面大不了,摊开了来说,就当是对方P2P爆雷咯。。。也不用太想太多了,也就只能这样了。。。根本做不了什么。。哎。。。只能是一次次地忍让,一次次地退步和妥协。。。也只能希望后面有个好点结果吧,就这样,也开始怀疑相关事情是否有好的结果。。。管不了,管不了。。

读书学习过一世,尽量活在自己的小世界里,这样,不用去管其他的纷纷扰扰,不管是做个肥宅,还是做个acer,也算是平庸地活着,充满生命力地活着,不要想什么其他的,不奢求太多,过好每一天,做好每一天的计划,按照计划不断地推进。。

锻炼部分,还是要坚持下去,换了新的健身房,去体验一下。。

时间的安排上,早上看是否可以抽出时间来学习,然后看学习什么东西。。。

加油,平庸的人!

原文链接

nginx mesh

service mesh 就是将一些公用的部分,抽象出来,作为control plane部分

Service Mesh可以定义为在微服务体系结构中处理服务间通信的基础结构层,它减少了与微服务体系结构相关的复杂性,并提供了许多治理功能,如 -

  • 负载均衡(Load Balancing)
  • 服务发现(Service Discovery)
  • 健康检查(Health Check)
  • 身份验证(Authentication)
  • 流量管理和路由(Traffic Management & Routing)
  • 断路和故障转移(Circuit Breaking and Failover Policy)
  • 安全(Security)
  • 监控(Metrics & Telemetry)
  • 故障注入(Fault Injection)

Sofa Mesh

sidecar的场景,

应用容器与日志同步工具在同一个Pod下,共享存储卷,应用程序生成的日志文件会由日志同步工具收集并发送到类似kafka,elasticsearch这样服务中。

在这样的架构下我们获得了什么呢?

  • 以容器作为基础打包单元,那么就可以分给不同的团队进行开发测试
  • Sidecar容器可重用,可以与不同的容器结合
  • 以容器作为错误边界,使服务能够独立开发和测试,比如应用服务在没有日志保存功能的情况下也可以独立运行
  • 独立回滚与更新(但需要考虑复杂的版本组合,建议使用语义版本管理对版本进行控制)

CSE Mesher架构

设计商业service mesh