Skip to content

Instantly share code, notes, and snippets.

Avatar

Hakan Eroztekin hakaneroztekin

View GitHub Profile
@hakaneroztekin
hakaneroztekin / statefulset-architecture.sh
Created Jul 29, 2022
statefulset-architecture [kubernetes in a nutshell]
View statefulset-architecture.sh
┏━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━┓
| my-pod-1 |--->| mysql (r/w replica) |
┗━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━┓
| my-pod-2 |--->| mysql (read replica) |
┗━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━┛
@hakaneroztekin
hakaneroztekin / service.yml
Created Jul 21, 2022
service [kubernetes in a nutshell]
View service.yml
apiVersion: v1
kind: Service
metadata:
name: basic-spring-service
spec:
type: NodePort
ports:
- port: 8080
nodePort: 30056
targetPort: 8080
@hakaneroztekin
hakaneroztekin / deployment-v2.yml
Created Jul 20, 2022
deployment-v2 [kubernetes in a nutshell]
View deployment-v2.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: basic-spring-app-deployment
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
@hakaneroztekin
hakaneroztekin / deployment.yml
Last active Jul 19, 2022
deployment [kube in a nutshell]
View deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: basic-spring-app-deployment
spec:
replicas: 5
selector:
matchLabels:
env: development
minReadySeconds: 15
@hakaneroztekin
hakaneroztekin / pod.yml
Last active Jul 19, 2022
pod [kubernetes in a nutshell]
View pod.yml
apiVersion: v1
kind: Pod
metadata:
name: basic-spring-app
labels:
env: development
spec:
containers:
- name: basic-spring-app
image: hakaneroztekin/basic-spring-app
@hakaneroztekin
hakaneroztekin / kube-architecture.sh
Created Jul 19, 2022
kube-architecture [kubernetes in a nutshell]
View kube-architecture.sh
control plane
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|┏━━━━━━━━━━┓ ┏━━━━━━━━━━━━━┓|
|| |<-->|cluster store||
|| | ┗━━━━━━━━━━━━━┛|
|| | ┏━━━━━━━━━━━━━┓|
kubectl<-->||api server|<-->| controller ||
|| | ┗━━━━━━━━━━━━━┛|
┏-->|| | ┏━━━━━━━━━━━━━┓|
| || |<-->| scheduler ||
@hakaneroztekin
hakaneroztekin / docker-compose-with-volume.yml
Created Jun 17, 2022
docker-compose-with-volume [docker in a nutshell]
View docker-compose-with-volume.yml
version: "3.7"
services:
spring-app:
build: .
image: spring-app
ports:
- "4000:8080"
networks:
- shared-network
depends_on:
@hakaneroztekin
hakaneroztekin / docker-spring-controller.java
Last active Jun 16, 2022
docker-spring-main-method [spring in a nutshell]
View docker-spring-controller.java
@RestController
@RequestMapping("/")
@RequiredArgsConstructor
public class GreetingsController {
private static final String DOCUMENT_KEY = "clickCount";
private final ClickCountRepository clickCountRepository;
@GetMapping
@hakaneroztekin
hakaneroztekin / docker-spring-redis-update-host.properties
Created Jun 16, 2022
docker-spring-redis-update-host [docker in a nutshell]
@hakaneroztekin
hakaneroztekin / docker-click-count-repository.java
Created Jun 16, 2022
docker-click-count-repository [docker in a nutshell]
View docker-click-count-repository.java
@Repository
public interface ClickCountRepository extends CrudRepository<ClickCount, String> {
}