1. Specify the deployment.yaml file.
Example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-gateway
spec:
replicas: 1
selector:
matchLabels:
app: api-gateway
template:
metadata:
labels:
app: api-gateway
spec:
containers:
- name: api-gateway
image: us-central1-docker.pkg.dev/<project-id>/<repository-name>/api-gateway
ports:
- containerPort: 8081
resources:
requests:
memory: "128Mi"
cpu: "125m"
limits:
memory: "128Mi"
cpu: "125m"
env:
# Accessing an env variable from the app-config config map
- name: GATEWAY_HTTP_ADDR
valueFrom:
configMapKeyRef:
key: GATEWAY_HTTP_ADDR
name: app-config
- name: JAEGER_ENDPOINT
valueFrom:
configMapKeyRef:
key: JAEGER_ENDPOINT
name: app-config
apiVersion: v1
kind: Service
metadata:
name: api-gateway
spec:
type: LoadBalancer
ports:
- port: 8081
targetPort: 8081
selector:
app: api-gateway
2. Access Google Cloud Console and create your GKE cluster
(this might take a while)
3. Execute the following command:
gcloud container clusters get-credentials <cluster-id> --region us-central-1 --project <project-id>
4. Upload the manifests.
Example:
kubectl apply -f infra/production/k8s/app-config.yaml
kubectl apply -f infra/production/k8s/secrets.yaml
kubectl apply -f infra/production/k8s/api-gateway-deployment.yaml
If you want to check the status of the deployments try the following commands:
kubectl get deployments
kubectl get pods
Top comments (0)