From 78061c3d4657c1d4740bfe0a5d98f9591ecc8bd9 Mon Sep 17 00:00:00 2001 From: strikerlulu Date: Thu, 2 May 2024 09:00:05 +0530 Subject: [PATCH] add k8s and buid it for arm --- Dockerfile.client | 4 +++- Dockerfile.server | 4 +++- k8s/client.yaml | 36 ++++++++++++++++++++++++++++++++++++ k8s/server.yaml | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 k8s/client.yaml create mode 100644 k8s/server.yaml diff --git a/Dockerfile.client b/Dockerfile.client index bbf1bd1..9a00125 100644 --- a/Dockerfile.client +++ b/Dockerfile.client @@ -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" ] diff --git a/Dockerfile.server b/Dockerfile.server index 6d2487e..7f5a685 100644 --- a/Dockerfile.server +++ b/Dockerfile.server @@ -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" ] diff --git a/k8s/client.yaml b/k8s/client.yaml new file mode 100644 index 0000000..0ebe5ca --- /dev/null +++ b/k8s/client.yaml @@ -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 diff --git a/k8s/server.yaml b/k8s/server.yaml new file mode 100644 index 0000000..acaae6a --- /dev/null +++ b/k8s/server.yaml @@ -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