From 327d69b2fa273e6f708035db6f9f6df73ac07b0b Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Thu, 9 Sep 2021 14:57:55 -0400 Subject: Commit k8s deployment config --- README.md | 37 +++++++++++++++++++++++++++++++--- kubernetes/deployment.yaml | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 kubernetes/deployment.yaml diff --git a/README.md b/README.md index 5199081..43bdd5b 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,16 @@ ### Using Docker -The Dockerfile works via a fresh clone, no pre-build is needed. It can be tagged as follows: +The Dockerfile works via a fresh clone, no pre-build or npm install is needed. It can be tagged as follows: ``` -docker build -t registry.digitalocean.com/submelon-tech/submelon.tech:latest . +docker build -t registry.digitalocean.com/submelon-tech/submelon.tech:1.0.0 . ``` Or if using M1/ARM, ``` -docker buildx build --platform linux/amd64 -t registry.digitalocean.com/submelon-tech/submelon.tech:latest . +docker buildx build --platform linux/amd64 -t registry.digitalocean.com/submelon-tech/submelon.tech:1.0.0 . ``` If the build fails in error as a result of the image, the base gatsby images can be rebuilt. (The gatsby images as exist on Dockerhub do not work.) To rebuild those images, run the following commands: @@ -37,3 +37,34 @@ docker buildx build --platform linux/amd64 -t gatsbyjs/gatsby:latest -f Dockerfi ``` And then attempt rebuild of the submelon.tech image. + +#### Authenticating with DO + +Install `doctl`. Create an access token via DO's web interface to authenticate with the registry, and connect docker: + +``` +doctl auth init +doctl registry login +``` + +Then push the image to the registry: + +``` +docker push registry.digitalocean.com/submelon-tech/submelon.tect:1.0.0 +``` + +#### DO K8s Deployment + +``` +doctl k8s cluster cfg save k8s-1-13-1-do-2-nyc1-1547908941746 + +## + +kubectl config use-context do-nyc1-k8s-1-13-1-do-2-nyc1-1547908941746 +``` + +Make version/environment changes to deployment config file, and apply: + +``` +kubectl apply -f kubernetes/deployment.yaml +``` \ No newline at end of file diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml new file mode 100644 index 0000000..39e20df --- /dev/null +++ b/kubernetes/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: "2021-04-22T06:20:12Z" + labels: + k8s-app: submelon-tech + name: submelon-tech + namespace: default + uid: 60ce2fb5-2fc4-4909-858c-fb76be2ecdf4 +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + k8s-app: submelon-tech + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + k8s-app: submelon-tech + name: submelon-tech + spec: + containers: + - image: registry.digitalocean.com/submelon-tech/submelon.tech:1.0.0 + imagePullPolicy: Always + name: submelon-tech + resources: + requests: + cpu: 250m + memory: 64Mi + limits: + memory: 128Mi + cpu: 500m + securityContext: + privileged: false + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + imagePullSecrets: + - name: doreg + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 -- cgit