​ Project introduction

Podinfo It's a use. Go Make small web Applications , It shows that in Kubernetes Best practices for running microservices in .

It has achieved the technical indicators ( Excerpt from the official README.md ):

How to realize every technical index in it , In fact, we can talk about it alone for a long time , There are many related theories .

I'm just talking about this project , How do we use Docker Try it out .

Build a container debugging environment


VSCode + golang/vscode-go

Go Domestic accelerated mirror image


To write Dockerfile.dev file

FROM golang:1.14

WORKDIR /workspace

# copy modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# Alibaba cloud
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct

# cache modules
RUN go mod download
RUN go get github.com/go-delve/delve/cmd/dlv

structure Image

docker build -f Dockerfile.dev -t podinfo:dev .

To write docker-compose.yaml

version: "3.4"
image: podinfo:dev
command: >
bash -c "ls -la
&& dlv debug /workspace/cmd/podinfo --headless --log -l --api-version=2"
- ./:/workspace
- 9898:9898
- 2345:2345
- "seccomp:unconfined"

To configure  .vscode  Of  launch.json

"version": "0.2.0",
"configurations": [
"name": "Remote Docker",
"type": "go",
"request": "launch",
"mode": "remote",
"port": 2345,
"host": "",
"program": "${workspaceFolder}",
"args": [],
"trace" : "verbose",
"env" : {}

Start playing

docker compose One button start

docker-compose up

Run Remote Docker

View home page


View to Prometheus Of  metrics API


Lower breakpoint , Send a request to debug

curl http://localhost:9898/api/info

Helm Charts


  • https://github.com/stefanprodan/podinfo/tree/master/charts/podinfo

because Podinfo It's a cloud native project , So it's Helm Charts It is worth learning and learning from .

Of course, you need to have some K8S Experience .

Helm install Podinfo

$ helm repo add podinfo https://stefanprodan.github.io/podinfo

$ helm upgrade -i my-release podinfo/podinfo

Helm uninstall Podinfo

$ helm delete my-release

See configuration , understand PodInfo How to get to the cloud ?

It's worth learning from

Parameters The default value is describe
replicaCount 1 Expectant K8S Pods( That is, the code deploys several instances in the cluster )
logLevel info

The level of logging :


or panic

backend None The back end that needs to be called or the third party URL( Such as Java Back end )
backends [] The back end that needs to be called or the third party URLs( Such as Java Back end )
cache None Redis Address  <host>:<port>
redis.enabled false Open or not Redis cache
ui.color #34577c UI Color
ui.message None UI Greeting message
ui.logo None UI logo
faults.delay false Random HTTP Response delay 0 To 5 second
faults.error false 1/3 The randomness of probability HTTP Response error
faults.unhealthy false After setting , Never reach a healthy state
faults.unready false When setting , Never get ready
faults.testFail false When setting ,helm Tests always fail
faults.testTimeout false When setting ,helm Tests always include timeouts
h2c.enabled false Allow upgrade to h2c
image.repository stefanprodan/podinfo Image libraries ( Address )
image.tag <VERSION> Mirror image tag
image.pullPolicy IfNotPresent Image Pull strategy
service.enabled true establish Kubernetes service , Use  Flagger  It should be disabled
service.type ClusterIP Kubernetes Service type
service.metricsPort 9797 Prometheus Index endpoint port
service.httpPort 9898 Container HTTP port
service.externalPort 9898 ClusterIP HTTP port
service.grpcPort 9999 ClusterIP gPRC port
service.grpcService podinfo gPRC service name
service.nodePort 31198 HTTP End point's NodePort
hpa.enabled false

Enable Kubernetes HPA

(Pod Horizontal auto retraction )

hpa.maxReplicas 10 Pods The largest number
hpa.cpu None Every Pod The goal of CPU Usage rate
hpa.memory None Every Pod Target memory usage of
hpa.requests None Every Pod Target per second HTTP request
serviceAccount.enabled false Should I create service account
serviceAccount.name None To be used service account The name of , If not set and enabled by true, Then use fullname Generate name
linkerd.profile.enabled false establish Linkerd Service profile
serviceMonitor.enabled false Should I create Prometheus Operator Service Monitor
serviceMonitor.interval 15s Prometheus Grab interval
ingress.enabled false Enable Ingress
ingress.annotations {} Ingress annotation
ingress.path /* Ingress route
ingress.hosts [] Ingress Accepted hosts
ingress.tls [] Ingress TLS To configure
resources.requests.cpu 1m Pod CPU request
resources.requests.memory 16Mi Pod Memory request
resources.limits.cpu None Pod CPU Limit
resources.limits.memory None Pod memory Limit
nodeSelector {} Pod Assigned cluster node label ( To put it bluntly, it is a fixed deployment to your designated machine )
tolerations [] List of tolerable node taints
affinity None Node/pod Affinity
podAnnotations {} Pod annotation


The author has revised Podinfo Project address

  • https://github.com/Hacker-Linner/podinfo

official  Podinfo

  • https://github.com/stefanprodan/podinfo

Podinfo, Mini Go More articles on microservice templates

  1. Universal spring cloud Microservice template

    documentation function 1. One key generation based on mapping database spring cloud Microservices 2. Universal Controller , You don't need to write code to complete database based services 3. Dynamic multi conditions CRUD + Pagination Instructions ...

  2. Learning together Microservices (MicroServices)- note

    note Microservice features : 1. Small Focus and do one thing ( It's best to fit the team ) 2. loose coupling Independent deployment 3. Process independence 4. Lightweight communication mechanism practice : 1. A series of infrastructure construction around micro service Load Balancing ...

  3. Customization in the era of micro services archetype( Templates / skeleton / The scaffold )

    1. Scene description (1) As microservices become more common , A large project will be split into several small microservices ,jar Packages and jar Version conflicts between , It's becoming more and more common , How to maintain the overall micro service group jar And the same version , It becomes more important ,mave ...

  4. Stage 5 3. Microservices 【 Learning online 】_day04 Page static _17- Page static - Template Management -GridFS Research - File

    Save the template information in cms_template Inside Stored in fs.chunks In this collection . This collection contains block files . fs.files It stores the basic information of the file chunks It's block information Create test file stay cms Of ...

  5. Stage 5 3. Microservices 【 Learning online 】_day04 Page static _16- Page static - Template Management - Template making

    This is the original file of the carousel Running the portal requires nginx Start it up Run the carousel alone . The inside of css All the references of the website are added with url This is the effect of a single access to the carousel The address of the carousel map template : Stage 5 3. Microservices [ Learning online ] ...

  6. Stage 5 3. Microservices 【 Learning online 】_day04 Page static _18- Page static - Template Management -GridFS Research - Access to documents

    Need to create mongoDB Configuration class 1 The configuration class mainly creates .GridFSBucket This object . This object is used to open a download stream stay cms Under the micro service of , stay config Create MongoConfig. At this time ...

  7. Micro service practice ( 6、 ... and ): Choose microservice deployment strategy - DockOne.io

    original text : Micro service practice ( 6、 ... and ): Choose microservice deployment strategy - DockOne.io [ Editor's words ] This blog is the sixth one to build applications with microservices , The first chapter introduces the microservice architecture template , The advantages and disadvantages of using microservices are also discussed . The following article discusses the differences between microservices ...

  8. Comprehensive use spring cloud Technology to realize microservice application

    In previous chapters , We have implemented the configuration server . Register the server . Microservice server , Service registration and discovery are realized . This chapter will implement the client of microservice , And joint debugging . To realize the whole spring cloud Framework core application . This paper belongs to <7 Heaven Society s ...

  9. In depth analysis of DC/OS 1.8 – Highly reliable micro service and big data management platform

    In depth analysis of DC/OS 1.8 – Highly reliable micro service and big data management platform Hello everyone , Welcome to this DC/OS Technology sharing . Let me introduce myself first , Liu chao ,Linker Networks chief architect ,Open DC/OS Community ...

  10. 【 original 】Docker Containers and Spring Boot Microservice application

    Docker Containers and Spring Boot Microservice application 1  What is? Docker 1.1 Docker Appearance Question 1 : The project implementation environment is complex In the process of traditional project implementation “ The program runs well with me , Why don't you ...

Random recommendation

  1. ASCII Computer code

    Bin Dec Hex abbreviation / character explain 0000 0000 0 00 NUL(null) Null character 0000 0001 1 01 SOH(start of headline) Title start 0000 00 ...

  2. Algorithm analysis Analysis of Algorithms -------GeekforGeeker translate

    Algorithm analysis  Analysis of Algorithms Why do you do performance analysis ?Why performance analysis? There are many important factors we should consider in the field of computer Like user friendliness , modularization , Security ...

  3. 【DFS/BFS】NYOJ-58- Minimum steps ( Maze shortest path problem )

    [ Topic link :NYOJ-58] Classic search questions , I think this question will be widely searched , So the first thing I do is to search extensively , But in fact, deep search is also possible . If you don't think about pruning , The practical cost of the two methods is the same , But deep search has less memory than wide search . I think , because ...

  4. winform When the tray is loaded , To run an instance , terms of settlement

    demand :winform Applications , When hidden in the tray , Run again exe Program , Let it run only one instance , And show the window from the tray The name of the application can be found in the following code , Get : Process current = Proces ...

  5. IE The events and w3c The difference between events

    14. offsetWidth, scrollLeft, scrollHeight?     scrollLeft: Sets or gets the distance between the left boundary of the object and the leftmost end of the currently visible content in the window scrollHeig ...

  6. Java Character encoding and decoding

    1. The development of character coding ①.ASCII code Because computers only know numbers , So all the data we have in the computer are represented by numbers , Because English characters are limited , So the highest bit of the specified byte is 0, Every byte is marked with 0-127 Between ...

  7. postman Could not get any response.

    Browser input address can return results , But because of the return json There is no format , Looks like a little bit of a hassle , use postman But report a mistake Could not get any response. Note that the following is a list of possible scenarios : For example, the server is not responding ...

  8. Win10 install docker Some do's and don 'ts

    Installation environment :Win10 Professional version 64 position ,Win7.Win8 To make use of docker toolbox To install . One . Occupy C The solution of disk space problem 1. hold vhdx Virtual hard disk from the default C Transfer the disk to another disk , After downloading the image in this way ...

  9. css No fixed width, horizontal center

    Reprint :http://www.cnblogs.com/jogen/p/5213566.html  The menu of this blog ui It's still great . Method 1   Ideas : The display sets the parent element to :table, The child element is :cell-table ...

  10. According to the vest 、 The app store 、 Statistics of daily registration , You can choose a vest and app, Vest and appstrore and user_login Different table problems

    This vest belongs to a watch ,appStore The other table , User login form , The main operation is the three tables . My vest and app Of id It's all the same as channel Corresponding , stay channel Deposit is majiaId + “|” ...