add k8s and buid it for arm

main
strikerlulu 2024-05-02 09:00:05 +05:30
parent 5acdde1026
commit 78061c3d46
4 changed files with 77 additions and 2 deletions

View File

@ -9,8 +9,10 @@ RUN go mod download
COPY . .
COPY pb ../pb
ENV GOOS=linux
ENV GOARCH=arm64
RUN go install -v ./...
EXPOSE 3000
CMD [ "client" ]
CMD [ "/go/bin/linux_arm64/client" ]

View File

@ -9,8 +9,10 @@ RUN go mod download
COPY . .
COPY pb ../pb
ENV GOOS=linux
ENV GOARCH=arm64
RUN go install -v ./...
EXPOSE 3000
CMD [ "server" ]
CMD [ "/go/bin/linux_arm64/server" ]

36
k8s/client.yaml 100644
View File

@ -0,0 +1,36 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: client-deployment
namespace: grpc-mocker
labels:
app: client
spec:
selector:
matchLabels:
app: client
replicas: 1
template:
metadata:
labels:
app: client
spec:
containers:
- name: client
image: harbor.strikerlulu.me/works/grpc-mocker/client
imagePullPolicy: Never
ports:
- name: client-service
containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: client-service
spec:
type: NodePort
selector:
app: client
ports:
- port: 3000
targetPort: client-service

35
k8s/server.yaml 100644
View File

@ -0,0 +1,35 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: server-deployment
namespace: grpc-mocker
labels:
app: server
spec:
selector:
matchLabels:
app: gcd
replicas: 3
template:
metadata:
labels:
app: server
spec:
containers:
- name: server
image: harbor.strikerlulu.me/works/grpc-mocker/server
imagePullPolicy: Never
ports:
- name: grpc-server
containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: grpc-server
spec:
selector:
app: grpc-srever
ports:
- port: 3000
targetPort: grpc-server