Skip to content

Commit

Permalink
added few cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshit8 committed Feb 23, 2021
1 parent 1bab912 commit b534c75
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
gcpServiceAccount/credentials.json
storage/.terraform/plugins
storage/.terraform
storage/.terraform*
storage/terraform*
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,57 @@ docker run -it --rm -v ${PWD}/storage:/storage -w /storage akshit8/terraform

chmod +x .terraform/providers/registry.terraform.io/hashicorp/google/3.54.0/linux_amd64/terraform-provider-google_v3.54.0_x5
```

## setting up a test cluster with kind
```bash
kind create cluster --name test-cluster --image kindest/node:v1.17.0

docker run -it --rm -v ${HOME}:/root/ -v ${PWD}:/work -w /work --net host debian:buster

apt-get update && apt install curl vim

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

chmod +x ./kubectl

mv ./kubectl /usr/local/bin/kubectl

root@my-vm:/work# kubectl get nodes
NAME STATUS ROLES AGE VERSION
test-cluster-control-plane Ready master 5m15s v1.17.0

curl -L -o /tmp/velero.tar.gz https://github.com/vmware-tanzu/velero/releases/download/v1.5.1/velero-v1.5.1-linux-amd64.tar.gz

tar -C /tmp -xvf /tmp/velero.tar.gz

mv /tmp/velero-v1.5.1-linux-amd64/velero /usr/local/bin/velero

chmod +x /usr/local/bin/velero

velero --help

kubectl create ns sample

kubectl -n sample apply -f ./k8s-objects

export BUCKET=velero-akshit
export REGION=asia-east1

velero install \
--provider gcp \
--plugins velero/velero-plugin-for-gcp:v1.1.0 \
--bucket $BUCKET \
--secret-file ./gcpServiceAccount/credentials.json

root@my-vm:/work# kubectl -n velero get pods
NAME READY STATUS RESTARTS AGE
velero-86bb45cdfb-987ps 1/1 Running 0 23s

kubectl logs deployment/velero -n velero

velero backup create sample-namespace-backup --include-namespaces sample

velero backup describe sample-namespace-backup

velero backup logs sample-namespace-backup
```
16 changes: 1 addition & 15 deletions k8s-objects/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,4 @@ spec:
cpu: "50m"
limits:
memory: "256Mi"
cpu: "500m"
#NOTE: comment out `volumeMounts` section for configmap and\or secret guide
volumeMounts:
- name: secret-volume
mountPath: /secrets/
- name: config-volume
mountPath: /configs/
#NOTE: comment out `volumes` section for configmap and\or secret guide
volumes:
- name: secret-volume
secret:
secretName: sample-secret
- name: config-volume
configMap:
name: sample-config #name of our configmap object
cpu: "500m"
4 changes: 0 additions & 4 deletions storage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ resource "google_storage_bucket" "k8s-backup" {
location = "ASIA-EAST1"

storage_class = "STANDARD"

labels {
usage = "storage bucket for k8s backup and restoration"
}
}
2 changes: 1 addition & 1 deletion storage/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ variable "region" {
}

variable "credentials_file" {
default = "gcpServiceAccount/credentials.json"
default = "../gcpServiceAccount/credentials.json"
description = "credential file name"
}

0 comments on commit b534c75

Please sign in to comment.