Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a39b22

Browse files
parent page for k8s deployment
1 parent60981d3 commit0a39b22

File tree

6 files changed

+203
-146
lines changed

6 files changed

+203
-146
lines changed

‎_data/home-content.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
url:''
176176
links:
177177
-title:Deployment options for Kubernetes
178-
localurl:/docs/deployments/kubernetes/deployment-options-to-kubernetes/
178+
localurl:/docs/deployments/kubernetes/
179179
-title:Managing Kubernetes clusters
180180
localurl:/docs/deployments/kubernetes/manage-kubernetes/
181181
-title:Using Helm in Codefresh pipelines

‎_data/nav.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@
312312
-title:Kubernetes
313313
url:"/kubernetes"
314314
sub-pages:
315-
-title:Deployment options for Kubernetes
316-
url:"/deployment-options-to-kubernetes"
315+
-title:Manual Deployments
316+
url:"/manual-deployment"
317+
-title:Automated Deployments
318+
url:"/automated-deployment"
317319
-title:Environment dashboard
318320
url:"/environment-dashboard"
319321
-title:Managing Kubernetes clusters

‎_docs/deployments/kubernetes.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title:"How to deploy to Kubernetes"
3+
description:"Learn the different Kubernetes deployment options"
4+
group:deployments
5+
toc:true
6+
---
7+
8+
Codefresh offers several options when it comes to Kubernetes deployments:
9+
10+
1. Codefresh UI for on-demand deployments
11+
This is the easiest deployment option for Kubernetes. See our[Kubernetes deployment quick start]({{site.baseurl}}/docs/quick-start/ci-quick-start/deploy-to-kubernetes/).
12+
1. Through a dedicated[deploy step]({{site.baseurl}}/docs/pipelines/steps/deploy/) in a pipeline.
13+
1. Through the[cf-deploy-kubernetes step]({{site.baseurl}}/docs/ci-cd-guides/kubernetes-templating/) in a pipeline
14+
Use this to also perform simple templating on Kubernetes manifests.
15+
1. Through a[freestyle]({{site.baseurl}}/docs/pipelines/steps/freestyle/) step with[Kustomize](https://kustomize.io){:target="\_blank"}.
16+
See[Deployment with Kustomize]({{site.baseurl}}/docs/example-catalog/cd-examples/deploy-with-kustomize).
17+
1. Using a freestyle step with your own`kubectl` commands
18+
This deployment option gives you great flexibility, but assumes that you know how to work with`kubectl`. See[Custom kubectl commands]({{site.baseurl}}/docs/deployments/kubernetes/custom-kubectl-commands/).
19+
1. Using Helm as a package manager
20+
See our[Helm deployment to Kubernetes quick start]({{site.baseurl}}/docs/quick-start/ci-quick-start/deploy-with-helm/).
21+
22+
##Prerequisites for all options
23+
24+
* A K8s cluster in Codefresh (see[Connecting a Kubernetes cluster]({{site.baseurl}}/docs/integrations/kubernetes/#connect-a-kubernetes-cluster)
25+
* Familiarity with the[Codefresh YAML for pipeline definitions]({{site.baseurl}}/docs/pipelines/what-is-the-codefresh-yaml/), basic[pipeline steps]({{site.baseurl}}/docs/pipelines/steps/), and how to describe them
26+
*[Docker registry integration]({{site.baseurl}}/docs/integrations/docker-registries/) in Codefresh
27+
28+
29+
##Related articles
30+
[Manage your Kubernetes cluster]({{site.baseurl}}/docs/deployments/kubernetes/manage-kubernetes/)
31+
[Environment dashboard]({{site.baseurl}}/docs/deployments/kubernetes/environment-dashboard/)
32+
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title:"Automated deployments"
3+
description:"Deploy to Kubernetes with a pipeline"
4+
group:deployments
5+
sub_group:kubernetes
6+
redirect_from:
7+
-/docs/deploy-to-kubernetes/environment-dashboard/
8+
-/docs/deploy-to-kubernetes/
9+
-/docs/deployment-to-kubernetes-quick-start-guide/
10+
-/docs/deploy-to-kubernetes/deployment-to-kubernetes-quick-start-guide/
11+
-/docs/deploy-to-kubernetes/get-ready-to-deploy/
12+
toc:true
13+
---
14+
15+
First you need a Docker image to deploy to the cluster.
16+
If you don't have one already you can use a Codefresh pipeline to build one.
17+
18+
##Build and push your image
19+
Here is a basic Codefresh pipeline scenario to build and push your image to the DockerHub registry.
20+
21+
`YAML`
22+
{% highlight yaml %}
23+
{% raw %}
24+
version: '1.0'
25+
steps:
26+
BuildImage:
27+
type: build
28+
image_name: '<your_docker_repo>/<your_image_name>' #specify your future image reference here
29+
dockerfile: Dockerfile
30+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
31+
32+
PushToDockerRegistry:
33+
type: push
34+
candidate: '${{BuildImage}}'
35+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
36+
registry: 'dockerhub' #the name of the registry you added to Codefresh
37+
{% endraw %}
38+
{% endhighlight %}
39+
40+
Using this YAML example, we'll add an additional step to deploy the image in Dockerhub to Kubernetes.
41+
42+
43+
##Add a Deployment step
44+
So now you have deployed your image manually, which is great.
45+
But, how can you trigger the deployment within your pipeline? For that you will need to add a step of type`Deploy` type to the Codefresh YAML manifest file:
46+
47+
`YAML`
48+
{% highlight yaml %}
49+
{% raw %}
50+
RunningDeployScript:
51+
title: Running Deploy Script
52+
type: deploy
53+
kind: kubernetes
54+
cluster: '<cluster_name>' #the name specified when you added the cluster
55+
namespace: <namespace_name> #the namespace you wish to deploy into
56+
service: <service_name> #the service you would like to update the deployment in
57+
candidate:
58+
image: '${{BuildImage}}'
59+
registry: 'dockerhub'
60+
{% endraw %}
61+
{% endhighlight %}
62+
63+
The full Codefresh YAML looks like this:
64+
65+
`YAML`
66+
{% highlight yaml %}
67+
{% raw %}
68+
version: '1.0'
69+
steps:
70+
BuildImage:
71+
type: build
72+
image_name: '<your_docker_repo>/<your_image_name>'
73+
dockerfile: Dockerfile
74+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
75+
76+
PushToDockerRegistry:
77+
type: push
78+
candidate: '${{BuildImage}}'
79+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
80+
registry: 'dockerhub' #the name of the registry you added to Codefresh
81+
82+
RunningDeployScript:
83+
title: Running Deploy Script
84+
type: deploy
85+
kind: kubernetes
86+
cluster: '<cluster_name>' #the name specified when you added the cluster
87+
namespace: <namespcae_name> #the namespace you wish to deploy into
88+
service: <service_name> #the service you would like to update the deployment in
89+
candidate:
90+
image: '${{BuildImage}}'
91+
registry: 'dockerhub'
92+
{% endraw %}
93+
{% endhighlight %}
94+
95+
You can now run the whole pipeline, that builds your application from source to a Docker image, pushes the image to a Docker registry, and deploys the image to your Kubernetes cluster.
96+
97+
##Related articles
98+
[Manage your Kubernetes cluster]({{site.baseurl}}/docs/deployments/kubernetes/manage-kubernetes/)
99+
[Environment dashboard]({{site.baseurl}}/docs/deployments/kubernetes/environment-dashboard/)

‎_docs/deployments/kubernetes/deployment-options-to-kubernetes.md‎

Lines changed: 0 additions & 143 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title:"Manual deployments"
3+
description:"Deploy to Kubernetes with the Codefresh GUI"
4+
group:deployments
5+
sub_group:kubernetes
6+
toc:true
7+
---
8+
9+
First you need a Docker image to deploy to the cluster.
10+
If you don't have one already you can use a Codefresh pipeline to build one.
11+
12+
##Build and push your image
13+
14+
Here is a basic Codefresh pipeline scenario to build and push your image to the DockerHub registry.
15+
16+
`YAML`
17+
{% highlight yaml %}
18+
{% raw %}
19+
version: '1.0'
20+
steps:
21+
BuildImage:
22+
type: build
23+
image_name: '<your_docker_repo>/<your_image_name>' #specify your future image reference here
24+
dockerfile: Dockerfile
25+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
26+
27+
PushToDockerRegistry:
28+
type: push
29+
candidate: '${{BuildImage}}'
30+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
31+
registry: 'dockerhub' #the name of the registry you added to Codefresh
32+
{% endraw %}
33+
{% endhighlight %}
34+
35+
Run the pipeline and the container image will be pushed to Dockerhub.
36+
37+
##Describe your deployment
38+
39+
The following instructions describe how to create a new service in your Kubernetes cluster in order to deploy to it.
40+
41+
42+
1. In the Codefresh UI, from Ops in the sidebar, select[**Kubernetes Services**](https://g.codefresh.io/kubernetes/services/){:target="\_blank"}.
43+
1. Click the button**Add Service**.
44+
1. Select the**cluster**.
45+
1. Select the**namespace**.
46+
1. Type an arbitrary**service name**.
47+
1. Specify the**number of replicas**.
48+
1. Type the name of your**pushed image**.
49+
1. In the**“Internal Ports”** field specify the port which your application listens to.
50+
1. In the**“Expose port”** field specify the port to be exposed to the Internet and check the checkbox.
51+
1. Click the button**“Deploy”** to deploy the application.
52+
53+
Wait until the deployment is completed, and you can open the deployed application in your browser by clicking on the "endpoint" link.
54+
55+
{% include image.html
56+
lightbox="true"
57+
file="/images/deployments/kubernetes/describe-k8s-deployment.png"
58+
url="/images/deployments/kubernetes/describe-k8s-deployment.png"
59+
alt="Describe Kubernetes deployment"
60+
caption="Describe Kubernetes deployment"
61+
max-width="60%"
62+
%}
63+
64+
##Related articles
65+
66+
[Manage your Kubernetes cluster]({{site.baseurl}}/docs/deployments/kubernetes/manage-kubernetes/)
67+
[Environment dashboard]({{site.baseurl}}/docs/deployments/kubernetes/environment-dashboard/)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp