Giter Club home page Giter Club logo

do-k8s-challenge's Introduction

do-k8s-challenge

This is my first official repo in Github and I am accepting the Digital Ocean Kubernetes Challenge

Challenge: Deploy an internal container registry

Kubernetes does not provide an internal container registry but it is often useful to add one. There are many projects which enable you to deploy an internal container registry, such as Harbour or Trow.

Steps

Install kubectl and doctl

Install Kubernetes command-line tool kubectl and DigitalOcean CLI tool doctl in your local machine.

Create kubernetes cluster in Digital Ocean (DO) dashboard.

DO offer clean UI and simplify the process to bring up a kubernetes cluster. Login to DO dashboard, and start your kubernetes journey.

Screenshot 2022-01-09 at 10 45 15 AM

Screenshot 2022-01-09 at 10 45 35 AM

Screenshot 2022-01-09 at 10 45 53 AM

Copy and paste the command from into your terminal to connect to your kubernetes cluster.

Screenshot 2022-01-09 at 10 47 58 AM

Once the k8s cluster created, you can verify it from DO dashboard, or from terminal.

Screenshot 2022-01-09 at 10 47 58 AM

kubectl get nodes

Output

NAME                STATUS   ROLES    AGE     VERSION
pool-harbor-u6n58   Ready    <none>   6m52s   v1.21.5
pool-harbor-u6n5c   Ready    <none>   6m55s   v1.21.5
pool-harbor-u6n5u   Ready    <none>   6m48s   v1.21.5

Install Helm

Install Helm in my local machine.

brew install helm

Harbor installation

The real challenge start here. I am using Bitnami Helm chart to deploy harbor.

Add Bitnami repo to Helm.

helm repo add bitnami https://charts.bitnami.com/bitnami

Output

% helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories

Create and edit harbor yaml file.

helm show values bitnami/harbor > harbor-values.yaml

If you own a domain name, edit the externalURL and commonName in harbor-values.yaml to your designated subdomain for harbor.

externalURL: https://core.harbor.domain
commonName: 'core.harbor.domain'

Install harbor with helm

helm install harbor -f harbor-values.yaml bitnami/harbor -n harbor --create-namespace

Output

NAME: harbor
LAST DEPLOYED: Sun Dec 26 11:05:15 2021
NAMESPACE: harbor
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: harbor
CHART VERSION: 11.1.6
APP VERSION: 2.4.1

** Please be patient while the chart is being deployed **

1. Get the Harbor URL:

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc --namespace harbor -w harbor'
  export SERVICE_IP=$(kubectl get svc --namespace harbor harbor --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
  echo "Harbor URL: http://$SERVICE_IP/"

2. Login with the following credentials to see your Harbor application

  echo Username: "admin"
  echo Password: $(kubectl get secret --namespace harbor harbor-core-envvars -o jsonpath="{.data.HARBOR_ADMIN_PASSWORD}" | base64 --decode)

Get harbor pods deployment and ensure all pods running.

kubectl get pods -n harbor

Output

NAME                                    READY   STATUS    RESTARTS   AGE
harbor-chartmuseum-6d565c4965-v57xt     1/1     Running   0          2m29s
harbor-core-75589849fc-xt6pr            1/1     Running   0          2m29s
harbor-jobservice-6644498d77-gphxg      1/1     Running   0          2m29s
harbor-nginx-685c86566c-8926k           1/1     Running   0          2m30s
harbor-notary-server-58cd7bcbd7-997v4   1/1     Running   0          2m30s
harbor-notary-signer-68f895db7c-xmvtb   1/1     Running   0          2m29s
harbor-portal-86bb64ff84-fhjcd          1/1     Running   0          2m29s
harbor-postgresql-0                     1/1     Running   0          2m29s
harbor-redis-master-0                   1/1     Running   0          2m29s
harbor-registry-d9bb7984-7n2m7          2/2     Running   0          2m29s
harbor-trivy-0                          1/1     Running   0          2m29s

harbor external IP

Get the external IP with this command,

kubectl get svc -n harbor -w harbor

Output

NAME    TYPE           CLUSTER-IP       EXTERNAL-IP       PORT(S)                                     AGE
harbor   LoadBalancer   10.245.100.223   144.126.241.233   80:31786/TCP,443:30983/TCP,4443:30188/TCP   41m

Create A record in DNS with the EXTERNAL-IP.

SSL/TLS Certificate

I am using Cloudflare to provision a public signed SSL certificate and proxied to harbor. Since I am using LoadBalancer mode to deploy my harbor, it will redirect http to https. Remember to set the SL/TLS encryption mode to Full.

Access to harbor.

Screenshot 2021-12-27 at 4 22 36 PM

Screenshot 2021-12-27 at 4 23 23 PM

Final thought

I would like to thank you Digital Ocean again by offering such a great challenge and I can finally get my hands into Kubernetes. Digital Ocean offer a very convenient way for those who want to setup any Kubernetes cluster environment in minutes!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.