Skip to content

Instantly share code, notes, and snippets.

@learngcpwithmahesh
learngcpwithmahesh / ingress-container-native-load-balancing.yaml
Created November 21, 2023 00:12
ingress-container-native-load-balancing
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deployment
spec:
selector:
matchLabels:
app: hello
template:
metadata:
apiVersion: apps/v1
kind: Deployment
metadata:
name: v1-deployment
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
# kubectl patch service blue-green-service -p '{"spec":{"selector":{"app":"green"}}}'
apiVersion: apps/v1
kind: Deployment
metadata:
name: blue-deployment
spec:
replicas: 4
strategy:
type: RollingUpdate
#kubectl set image deployment recreate-deployment lgwm-image=gcr.io/google-samples/hello-app:2.0
apiVersion: apps/v1
kind: Deployment
metadata:
name: recreate-deployment
spec:
replicas: 4
strategy:
type: Recreate
#kubectl set image deployment rolling-update-deployment lgwm-image=gcr.io/google-samples/hello-app:2.0
apiVersion: apps/v1
kind: Deployment
metadata:
name: rolling-update-deployment
spec:
replicas: 4
strategy:
type: RollingUpdate
WITH device_details AS (
SELECT 'deviceA' AS unique_id, '{"data":"deviceA"}' AS data, '2022-02-03 11:00:00' as event_time
UNION ALL select 'deviceA', '{"data":"deviceA"}', '2022-02-03 11:00:00' --duplicate
UNION ALL select 'deviceB', '{"data":"deviceB"}', '2022-02-02 10:00:00'
UNION ALL select 'deviceA', '{"data":"deviceA"}', '2022-02-02 10:00:00'
UNION ALL select 'deviceB', '{"data":"deviceB"}', '2022-02-02 10:00:00' --duplicate
UNION ALL select 'deviceC', '{"data":"deviceC"}', '2022-02-04 10:00:00'
UNION ALL select 'deviceB', '{"data":"deviceB"}', '2022-02-02 10:00:00' --duplicate
),
WITH device_details AS (
SELECT 'deviceA' AS unique_id, '{"data":"deviceA"}' AS data, '2022-02-03 11:00:00' as event_time
UNION ALL select 'deviceA', '{"data":"deviceA"}', '2022-02-03 11:00:00' --duplicate
UNION ALL select 'deviceB', '{"data":"deviceB"}', '2022-02-02 10:00:00'
UNION ALL select 'deviceA', '{"data":"deviceA"}', '2022-02-02 10:00:00'
UNION ALL select 'deviceB', '{"data":"deviceB"}', '2022-02-02 10:00:00' --duplicate
UNION ALL select 'deviceC', '{"data":"deviceC"}', '2022-02-04 10:00:00'
UNION ALL select 'deviceB', '{"data":"deviceB"}', '2022-02-02 10:00:00' --duplicate
),
Zone=$(curl -s http://metadata.google.internal/computeMetadata/v1/instance/zone -H "Metadata-Flavor: Google")
echo "Your CloudShell is in "$Zone
apiVersion: v1
kind: Pod
metadata:
name: hello
labels:
name: hello
spec:
containers:
- name: hello
image: gcr.io/google-samples/hello-app:2.0
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deployment
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%