Entradas

Mostrando entradas de 2022

Create a docker image from a spring boot project

In order to create a docker image from a spring boot project, First, your pom.xml has to be configured. <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- Cofiguration for creating a docker image --> <image> <name>chamow01/${project.artifactId}</name> </image> </configuration> </plugin> </plugins> </build> Then, the next maven command needs to be applied, so spring boot uses paketo-buildpacks in order to create a docker image based on you Java code mvn spring-boot:build-image ... [INFO] > Running creator [INFO] [creator] ===> DETECTING [INFO] [creator] 6 of 24 buildpacks participating [INFO] [creator] paketo-buildpacks/ca-certificates 3.2.0 [INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.3.2 [INFO]

Create a docker image from a spring boot project

In order to create a docker image from a spring boot project, First, your pom.xml has to be configured. <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- Cofiguration for creating a docker image --> <image> <name>chamow01/${project.artifactId}</name> </image> </configuration> </plugin> </plugins> </build> Then, the next maven command needs to be applied, so spring boot uses paketo-buildpacks in order to create a docker image based on you Java code mvn spring-boot:build-image ... [INFO] > Running creator [INFO] [creator] ===> DETECTING [INFO] [creator] 6 of 24 buildpacks participating [INFO] [creator] paketo-buildpacks/ca-certificates 3.2.0 [INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.3.2 [INFO]

Revert changes to a specifi commit

  Steps for reverting code to a specific commit: Resets index to former commit; replace '56e05fced' with your commit code git reset 56e05fced Moves pointer back to previous HEAD git reset --soft HEAD@{1} Commit de revert git commit -m "Revert to 56e05fced" Updates working copy to reflect the new commit git reset --hard Origin: https://stackoverflow.com/questions/4114095/how-to-revert-a-git-repository-to-a-previous-commit

Kubernetes - Relación entre un POD y un SERVICE

Imagen
A continuación se detalla como se comunica un Pod con un Service en el cluster de Kubernetes Diagrama de configuración Archivo client-pod.yaml apiVersion: v1 kind: Pod metadata: name: client-pod labels: component: web spec: containers: - name: client image: stephengrider/multi-client ports: - containerPort: 3000 resources: limits: memory: "128Mi" cpu: "500m" labels: Permite asignar un nombre al pod. Es una relación clave-valor; en este caso componente:web ports: Permite asignar el valor del puerto por donde el pod va a escuchar Archivo client-node-port.yaml apiVersion: v1 kind: Service metadata: name: client-node-port spec: type: NodePort ports: - port: 3050 targetPort: 3000 nodePort: 31515 selector: component: web selector: Permite asociar el servicio al pod, mediante la relación clave-valor; en este caso componente:web

Kubernetes -Tipos de objetos

Imagen
A continuación se detalla los tipos de objetos se se pueden configurar en Kubernetes de acuerdo a version del api apiVersion: v1 Objeto Descripción componentStatus Endpoint Namespace configMap Event Pod Es una agrupación de contenedores con un mismo propósito en común. Un pod es la unidad más pequeña que se puede deployar en Kubernetes Ejemplo archivo client-pod.yaml apiVersion: v1 kind: Pod metadata: name: client-pod labels: #name: myapp component: web spec: containers: - name: client image: stephengrider/multi-client ports: - containerPort: 3000 resources: limits: memory: "128Mi" cpu: "500m"

Comandos Kubernetes

Imagen
A continuación se detalla un listado de comandos para Kubernetes Comando Descripción Ejemplo Básicos kubectl cluster-info Información del cluster de kubernetes, configurado en el proceso de instalación kubectl cluster-info kubectl apply -f <filename> Permite cambiar la configuración del cluster de Kubernetes kubectl apply -f client-pod.yaml kubectl apply -f client-node-port.yaml kubectl get <object type> Permite verificar el estado de los pods kubectl get pods kubectl get services kubectl get all kubectl describe <object ty