-
Notifications
You must be signed in to change notification settings - Fork 0
4. Artifactory Setup
Praneeth Reddy Noti edited this page Aug 30, 2021
·
2 revisions
- Open the cloud shell from the GKE cluster created earlier and connect to the project
gcloud container clusters get-credentials artifactory-oss-cluster --zone us-central1-a --project infra-inkwell-323006
- Download the latest version of artifactory oss from jfrog repository
docker pull docker.bintray.io/jfrog/artifactory-oss:latest
- Now create a repository in gloud for storing container images for deploying to gke
export PROJECT_ID=infra-inkwell-323006
gcloud config set project $PROJECT_ID
gcloud artifacts repositories create devops-tools --repository-format=docker --location=us-central1 --description="Docker repository"
docker tag docker.bintray.io/jfrog/artifactory-oss us-central1-docker.pkg.dev/${PROJECT_ID}/devops-tools/artifactory-oss:latest
gcloud auth configure-docker us-central1-docker.pkg.dev
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.bintray.io/jfrog/artifactory-oss latest 5edb92baa394 13 days ago 825MB
us-central1-docker.pkg.dev/infra-inkwell-323006/devops-tools/artifactory-oss latest 5edb92baa394 13 days ago 825MB
docker push us-central1-docker.pkg.dev/infra-inkwell-323006/devops-tools/artifactory-oss
- Create a Kubernetes Deployment for the above artifactory Docker image.
kubectl create deployment artifactory --image=us-central1-docker.pkg.dev/${PROJECT_ID}/devops-tools/artifactory-oss:latest
kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
arti-oss 1/1 1 1 14h
artifactory 1/1 1 1 5s
kubectl get pods
NAME READY STATUS RESTARTS AGE
arti-oss-8668c66455-djrz2 1/1 Running 0 14h
artifactory-5c94d6b954-fqrrl 1/1 Running 0 64m
- Set the autoscaling if needed
kubectl scale deployment artifactory --replicas=3
kubectl autoscale deployment artifactory --cpu-percent=80 --min=1 --max=5
- Check the deployment from UI console and expose ports to access artifactory from internet
Artifactory service runs on two ports 8081 for RSET Api and 8082 for UI, these will be exposed to internet using Loadbalancer service
- Access the Artifactory UI by visiting the exposed endpoints
Changes made to the above created artifactory are not permanent as there is no persistent storage attached to the pod. Let's create a PVC and attach to the pod.
- Connect to the gcloud shell and create a yaml file for the PVC.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: artifact-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- Create the PVC by applying the above yaml.
kubectl apply -f artifactory-pvc.yaml
ctory-pvc.yaml
pranereddy@cloudshell:~ (infra-inkwell-323006)$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
arti-storage Bound pvc-5480933d-82b6-49b8-a307-a7a3febedde9 10Gi RWO standard 15h
artifact-storage Bound pvc-b344edd1-7994-4e8d-b9ff-9e089a08abe0 10Gi RWO standard 89m
- Edit the deployment yaml file from UI console, add the volume details to the yaml
- Now, visit the Artifactory UI endpoint and change default admin password and create sample repositories.