Skip to main content

Hello world pull from Trustnest Artifactory

Prerequisites

To run this onboarding tutorial, we should first have:

  • a k8saas cluster deployed
info

To ask and set up your own cluster, look at the section Getting Started.

  • docker engine running on your computer

And downloaded the following files:

Upload image to Trustnest Artifactory

First, login to Artifactory with Docker using our documentation: [here]

Pull and tag the image:

docker pull mcr.microsoft.com/azuredocs/aks-helloworld:v1
docker tag mcr.microsoft.com/azuredocs/aks-helloworld:v1 artifactory.thalesdigital.io/docker-internal/k8saas/helloworld/aks-helloworld-$K8SAAS_RESOURCE_NAME:latest
docker push artifactory.thalesdigital.io/docker-internal/k8saas/helloworld/aks-helloworld-$K8SAAS_RESOURCE_NAME:latest
note

Be sure to change $K8SAAS_RESOURCE_NAME with your instance name.

Deploy the application from ArtiFactory

Edit the deployment file with your image name and url link:

LC_ALL=C find ./ -type f -exec sed -i '' -e 's/INSTANCE_NAME/$K8SAAS_RESOURCE_NAME/g' {} \;

Create secret to access Artifactory from the Kubernetes cluster.

kubectl create secret docker-registry regcred-af --namespace dev --docker-server=artifactory.thalesdigital.io --docker-username=$K8SAAS_ARTIFACTORY_EMAIL --docker-password=$K8SAAS_ARTIFACTORY_API_KEY
note

Be sure to change $K8SAAS_RESOURCE_NAME, $K8SAAS_ARTIFACTORY_EMAIL and $K8SAAS_ARTIFACTORY_API_KEY with your values.

Deploy resources and check their availability:

kubectl apply -f aks-helloworld-one.yaml --namespace dev
kubectl get pods --namespace dev
# aks-helloworld-artifactory-54ff5cff7c-zw59x 2/2 Running

kubectl apply -f hello-world-ingress.yaml --namespace dev
kubectl get ingress --namespace dev
# hello-world-ingress-artifactory <none> hello-world-ingress-af.INSTANCE_NAME.kaas.thalesdigital.io 20.81.14.231 80, 443

Now, open a browser and consult your first application: https://hello-world-ingress-af.<INSTANCE_NAME>.kaas.thalesdigital.io

or in a shell:

curl -k https://hello-world-ingress.demo.kaas.thalesdigital.io
info

The application have been successfully deployed using an image from Trustnest ArtiFactory.

Remove your test

kubectl delete -f aks-helloworld-one.yaml --namespace dev
kubectl delete -f hello-world-ingress.yaml --namespace dev