Manual deployments
Deploy to Kubernetes with the Codefresh GUI
First you need a Docker image to deploy to the cluster. If you don’t have one already you can use a Codefresh pipeline to build one.
Build and push your image
Here is a basic Codefresh pipeline scenario to build and push your image to the DockerHub registry.
YAML
version: '1.0'
steps:
BuildImage:
type: build
image_name: '<your_docker_repo>/<your_image_name>' #specify your future image reference here
dockerfile: Dockerfile
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
PushToDockerRegistry:
type: push
candidate: '${{BuildImage}}'
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
registry: 'dockerhub' #the name of the registry you added to CodefreshRun the pipeline and the container image will be pushed to Dockerhub.
Describe your deployment
The following instructions describe how to create a new service in your Kubernetes cluster in order to deploy to it.
- In the Codefresh UI, from Ops in the sidebar, select Kubernetes Services.
- Click the button Add Service.
- Select the cluster.
- Select the namespace.
- Type an arbitrary service name.
- Specify the number of replicas.
- Type the name of your pushed image.
- In the “Internal Ports” field specify the port which your application listens to.
- In the “Expose port” field specify the port to be exposed to the Internet and check the checkbox.
- Click the button “Deploy” to deploy the application.
Wait until the deployment is completed, and you can open the deployed application in your browser by clicking on the “endpoint” link.