diff --git a/kubernetes/01-hello-world-rest-api/deployment.yaml b/kubernetes/01-hello-world-rest-api/deployment.yaml new file mode 100644 index 00000000..636adb75 --- /dev/null +++ b/kubernetes/01-hello-world-rest-api/deployment.yaml @@ -0,0 +1,81 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + autopilot.gke.io/resource-adjustment: '{"input":{"containers":[{"name":"hello-world-rest-api"}]},"output":{"containers":[{"limits":{"ephemeral-storage":"1Gi"},"requests":{"cpu":"500m","ephemeral-storage":"1Gi","memory":"2Gi"},"name":"hello-world-rest-api"}]},"computeClassAtAdmission":"Default","modified":true}' + autopilot.gke.io/warden-version: 33.33.19-gke.1 + deployment.kubernetes.io/revision: "5" + creationTimestamp: "2025-10-16T02:55:03Z" + generation: 6 + labels: + app: hello-world-rest-api + name: hello-world-rest-api + namespace: default + resourceVersion: "1761451092369951013" + uid: 9fedc012-0f0f-4ee7-a3ba-52ec78bb91b7 +spec: + progressDeadlineSeconds: 600 + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: hello-world-rest-api + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: hello-world-rest-api + spec: + containers: + - image: in28min/hello-world-rest-api:0.0.1.RELEASE + imagePullPolicy: IfNotPresent + name: hello-world-rest-api + resources: + limits: + ephemeral-storage: 1Gi + requests: + cpu: 500m + ephemeral-storage: 1Gi + memory: 2Gi + securityContext: + capabilities: + drop: + - NET_RAW + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + seccompProfile: + type: RuntimeDefault + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoSchedule + key: kubernetes.io/arch + operator: Equal + value: amd64 +status: + availableReplicas: 2 + conditions: + - lastTransitionTime: "2025-10-16T03:33:53Z" + lastUpdateTime: "2025-10-16T03:33:53Z" + message: Deployment has minimum availability. + reason: MinimumReplicasAvailable + status: "True" + type: Available + - lastTransitionTime: "2025-10-16T02:55:03Z" + lastUpdateTime: "2025-10-26T03:58:12Z" + message: ReplicaSet "hello-world-rest-api-fd687cfd4" has successfully progressed. + reason: NewReplicaSetAvailable + status: "True" + type: Progressing + observedGeneration: 6 + readyReplicas: 2 + replicas: 2 + updatedReplicas: 2 diff --git a/kubernetes/01-hello-world-rest-api/service.yaml b/kubernetes/01-hello-world-rest-api/service.yaml new file mode 100644 index 00000000..311b77ff --- /dev/null +++ b/kubernetes/01-hello-world-rest-api/service.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + cloud.google.com/neg: '{"ingress":true}' + creationTimestamp: "2025-10-15T03:36:26Z" + finalizers: + - service.kubernetes.io/load-balancer-cleanup + - gke.networking.io/l4-netlb-v1 + labels: + app: hello-world-rest-api + name: hello-world-rest-api + namespace: default + resourceVersion: "1760499574672943007" + uid: e95a4165-4017-49bb-94fa-3f5b9bb045c9 +spec: + allocateLoadBalancerNodePorts: true + clusterIP: 34.118.228.162 + clusterIPs: + - 34.118.228.162 + externalTrafficPolicy: Cluster + internalTrafficPolicy: Cluster + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - nodePort: 32676 + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: hello-world-rest-api + sessionAffinity: None + type: LoadBalancer +status: + loadBalancer: + ingress: + - ip: 34.60.229.1 + ipMode: VIP diff --git a/projects/hello-world/hello-world-nodejs/Dockerfile b/projects/hello-world/hello-world-nodejs/Dockerfile index 374f6d47..9ffcb7f7 100755 --- a/projects/hello-world/hello-world-nodejs/Dockerfile +++ b/projects/hello-world/hello-world-nodejs/Dockerfile @@ -1,8 +1,9 @@ FROM node:8.16.1-alpine WORKDIR /app -COPY . /app +COPY package.json /app RUN npm install EXPOSE 5000 +COPY . /app CMD node index.js #ENTRYPOINT ["node", "index.js"] diff --git a/projects/hello-world/hello-world-nodejs/index.js b/projects/hello-world/hello-world-nodejs/index.js index 3d23b495..2890b7a2 100755 --- a/projects/hello-world/hello-world-nodejs/index.js +++ b/projects/hello-world/hello-world-nodejs/index.js @@ -3,7 +3,7 @@ const process = require('process'); var expressapp = express() expressapp.get('/', function (req, res) { - res.send('{"message":"Hello World JavaScript v1"}') + res.send('{"message":"Hello World JavaScript v3"}') }) expressapp.listen(5000, function () { console.log('Ready on port 5000!') diff --git a/projects/hello-world/hello-world-python/Dockerfile b/projects/hello-world/hello-world-python/Dockerfile index 5b542c28..dab63a3a 100755 --- a/projects/hello-world/hello-world-python/Dockerfile +++ b/projects/hello-world/hello-world-python/Dockerfile @@ -7,3 +7,5 @@ CMD python ./launch.py #COPY requirements.txt /app/requirements.txt #ENTRYPOINT ["python", "./launch.py"] + + diff --git a/projects/hello-world/hello-world-python/launch.py b/projects/hello-world/hello-world-python/launch.py index 3a161a5e..6cb4b393 100755 --- a/projects/hello-world/hello-world-python/launch.py +++ b/projects/hello-world/hello-world-python/launch.py @@ -2,6 +2,6 @@ helloworld = Flask(__name__) @helloworld.route("/") def run(): - return "{\"message\":\"Hello World Python v1\"}" + return "{\"message\":\"Hello World Python v3\"}" if __name__ == "__main__": helloworld.run(host="0.0.0.0", port=int("5000"), debug=True) \ No newline at end of file