diff --git a/Kubernetes/code-server-scv.yaml b/Kubernetes/code-server-scv.yaml new file mode 100644 index 0000000..421fac6 --- /dev/null +++ b/Kubernetes/code-server-scv.yaml @@ -0,0 +1,14 @@ +kind: Service +apiVersion: v1 +metadata: + name: code-server-svc + namespace: default +spec: + selector: + app: code-server + type: ClusterIP + ports: + - protocol: TCP + name: code-server-main + port: 80 + targetPort: 8080 \ No newline at end of file diff --git a/Kubernetes/code-server.yaml b/Kubernetes/code-server.yaml new file mode 100644 index 0000000..74b2cde --- /dev/null +++ b/Kubernetes/code-server.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: code-server + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: code-server + template: + metadata: + labels: + app: code-server + spec: + containers: + - name: code-server + image: codercom/code-server:3.4.1 + #Los invito a usar mi imagen personalizada de code-server. + #image: aleleba/code-server:2.0.2 + imagePullPolicy: Always + #Pueden exponer cualquier puerto que necesiten que use su aplicación. El Puerto 8080 tienen que exponerlo siempre + ports: + - containerPort: 8080 + resources: + requests: + memory: "1Gi" + cpu: "2" + limits: + memory: "1.2Gi" + cpu: "2.2" + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: code-server-secret + key: PASSWORD + #Habilitar si desean conectarse a docker de host. + #volumeMounts: + #- mountPath: "/var/run/docker.sock" + #name: dockersock + #volumes: + #- name: dockersock + #hostPath: + #path: /var/run/docker.sock \ No newline at end of file diff --git a/Kubernetes/ingress.yaml b/Kubernetes/ingress.yaml new file mode 100644 index 0000000..d2e72ad --- /dev/null +++ b/Kubernetes/ingress.yaml @@ -0,0 +1,19 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ingress + namespace: default + annotations: + kubernetes.io/ingress.class: nginx + nginx.org/websocket-services: "code-server-svc, mongoclient-svc" + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/use-regex: "true" +spec: + rules: + - host: code-server.p-lao.tk + http: + paths: + - path: / + backend: + serviceName: code-server-svc + servicePort: 80 \ No newline at end of file diff --git a/Kubernetes/secret.yaml b/Kubernetes/secret.yaml new file mode 100644 index 0000000..a076db5 --- /dev/null +++ b/Kubernetes/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: code-server-secret + namespace: default +type: Opaque +data: + PASSWORD: cGFzc3dvcmQ= \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b54fc46 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# ¿Cómo Montar Entorno de Desarrollo en Docker-Compose y Kubernetes con Code-Server? \ No newline at end of file