- Deploying to OKE
Push a Docker image of your Helidon application to Oracle Cloud Infrastructure Registry (OCIR), and deploy the image from the registry to Oracle Cloud Infrastructure Container Engine for Kubernetes (OKE).
What You Need
| About 10 minutes |
| Helidon prerequisites |
| An OKE cluster. See the OKE documentation. |
| A Helidon project created from the quickstart Maven archetype. See quickstart Maven archetype. |
Push Your Image to OCIR
Your account must be in the Administrators group or another group that has the REPOSITORY_CREATE permission.
Sign in to the Oracle Cloud Infrastructure (OCI) web console and generate an authentication token. See Getting an Auth Token.
Remember to copy the generated token. You won’t be able to access it again.
docker login \
-u <username> \
-p <password> \
<region-code>.ocir.io - The user name in the format
<tenancy_name>/<username>. - The password is the generated token.
<region-code>is the code for the OCI region that you’re using. For example, the region code for Phoenix isphx. See Regions and Availability Domains.
docker tag \
helidon-quickstart-se:latest \
<region-code>.ocir.io/<tenancy-name>/<repo-name>/<image-name>:<tag> - the local image to tag
<repo-name>is optional. It is the name of a repository to which you want to push the image (for example,project01).
docker push \
<region-code>.ocir.io/<tenancy-name>/<repo-name>/<image-name>:<tag>You can pull your image with the image path used above, for example: phx.ocir.io/helidon/example/helidon-quickstart-se:latest
Setup your K8s Cluster
Create a namespace (for example, helidon) for the project:
kubectl create namespace helidonThe repository that you created is private. To allow Kubernetes to authenticate with the container registry and pull the private image, you must create and use an image-pull secret.
kubectl create secret docker-registry \
ocirsecret \
--docker-server=<region-code>.ocir.io \
--docker-username='<tenancy-name>/<oci-username>' \
--docker-password='<oci-auth-token>' \
--docker-email='<email-address>' \
--namespace helidon - The name of the config secret
- The docker registry (see docker tag step above)
- The user name (see docker login step above)
- The password (see docker login step above)
- The namespace created in the previous step
Deploy the Image to Kubernetes
First, change to the helidon-quickstart-se directory.
Then edit app.yaml and add the following under spec in the deployment section:
spec:
imagePullSecrets:
- name: ocirsecret
containers:
- name: helidon-quickstart-se
image: phx.ocir.io/helidon/example/helidon-quickstart-se:latest
imagePullPolicy: Always
ports:
- containerPort: 8080- The config secret name
- The image path
kubectl create -f app.yaml -n helidonNodePort number for your new pod:kubectl get svc -n helidonkubectl get nodesYou can now access the application at http://<NodeIpAddress>:<NodePort>/greet.