module
0.0.0-20240914081027-2e6bda2c918f
Repository: https://github.com/ironzhang/sns.git
Documentation: pkg.go.dev
# README
English | 中文
SNS
Overview
SNS(super-name-system) is a DNS-like product developed for intranet service discovery. Users can use the SDKs to resolve domain names into IP:Port. The difference from DNS is SNS provides flexible traffic scheduling capabilities. Base on this, users can quickly build functions such as Sentinel-Stress-Testing, Blue-Green-Deployment.
the domain name in SNS is a specific concept, similar to the domain name in DNS, but not exactly the same.
Quick Start
Requirements
- go version >= 1.22.3
- A working docker environment
Installation
step 1: setup
git clone [email protected]:ironzhang/sns.git
(cd sns/scripts/setup && ./setup.sh init)
step 2: run sns-agent
(cd sns/sns-agent && make && ./sns-agent)
Usage
first, we create some k8s pods
kubectl apply -f deployment.yaml
The deployment.yaml is as follows:
apiVersion: apps/v1
kind: Deployment
metadata:
name: k8s-myapp-deployment
labels:
app: k8s-myapp-deployment-v1
spec:
replicas: 1
selector:
matchLabels:
app: myapp
cluster: dev.default.k8s
template:
metadata:
labels:
app: myapp
cluster: dev.default.k8s
spec:
containers:
- name: nginx
image: nginx:1.22
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
then, we can use sns-lookup to resolve the domains
sns-lookup sns/http.myapp
sns-lookup sns/https.myapp
we can use the SDK to resolve the domains too, see supernamego.