Skip to content

Instantly share code, notes, and snippets.

View bharatmicrosystems's full-sized avatar
😀

Gaurav Agarwal bharatmicrosystems

😀
View GitHub Profile
#! /bin/bash
docker_username=$1
set -xe
curl -sL https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64 -o /usr/local/bin/kind
chmod 755 /usr/local/bin//kind
curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl
chmod 755 /usr/local/bin//kubectl
FROM nginx
RUN echo 'Hello World' > /usr/share/nginx/html/index.html
name: Docker Image CI
on: [push]
# Environment variables available to all jobs and steps in this workflow
env: # Or as an environment variable
docker_username: ${{ secrets.DOCKER_USER }}
docker_password: ${{ secrets.DOCKER_PW }}
jobs:
$ cat <<EOF | kubectl apply -f -
apiVersion: autoscaling.k8s.io/v1beta2
kind: VerticalPodAutoscaler
metadata:
name: nginx-vpa
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: nginx
$ cat <<EOF | kubectl apply -f -
apiVersion: autoscaling.k8s.io/v1beta2
kind: VerticalPodAutoscaler
metadata:
name: nginx-vpa
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: nginx
$ cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
spec:
replicas: 2
selector:
apiVersion: autoscaling.k8s.io/v1beta2
kind: VerticalPodAutoscaler
metadata:
name: nginx-vpa
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: nginx
updatePolicy:
tolerations:
- key: "cloud.google.com/gke-preemptible"
operator: "Exists"
effect: "NoSchedule"
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
secretName: ingress-nginx-admission
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: cloud.google.com/gke-preemptible
operator: In
values:
- "true"
kubectl get node
NAME STATUS ROLES AGE VERSION
gke-cluster-1-default-pool-17734f1e-2zdk Ready <none> 65m v1.16.13-gke.1
gke-cluster-1-default-pool-17734f1e-dsht Ready <none> 65m v1.16.13-gke.1
gke-cluster-1-preemtible-pool-ce21ea76-mknh Ready <none> 64m v1.16.13-gke.1
gke-cluster-1-preemtible-pool-ce21ea76-zb7c Ready <none> 64m v1.16.13-gke.1
gke-cluster-1-preemtible-pool-ce21ea76-gyhe Ready <none> 4m v1.16.13-gke.1