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

A Codefresh step to deploy to Kubernetes

NotificationsYou must be signed in to change notification settings

codefresh-io/cf-deploy-kubernetes

 
 

Repository files navigation

This is the source code for thecodefresh/cf-deploy-kubernetes container.This container is used to demonstrate a Kubernetes deployment using Codefresh.io

Assumptions

The deployment script makes the following assumptions about your application andKubernetes configuration:

  1. The application is deployed using the Kubernetes deployment API (versus thethe replication controller directly). For more information readhttp://kubernetes.io/docs/user-guide/deployments/
  2. The tested codebase has a yaml file (i.e. deployment.yml) that describes the Kubernetes deploymentparameters and configuration of your application.
  3. The script processes deployment.yml as a simple template where all{{ ENV_VARIABLE }} are replaced with a value of $ENV_VARIABLE deployment.yml

Configuration

The following env variables control the deployment configuration:

  1. KUBERNETES_DEPLOYMENT_TIMEOUT - How much to wait for a successful deployment before failing the build. Defaults to 120 (secs).
  2. KUBECONTEXT - corresponds to the name of a cluster added to codefresh
  3. KUBERNETES_NAMESPACE - The namespace to deploy
  4. KUBECTL_ACTION - means an action forkubectl <action>. Valid values are apply|create|replace. Default is "apply"

Optional:

SERVER_VERSION - Manually set the Minor kubectl version. Supports 10-22.

Usage in codefresh.io

deployment.yml

---apiVersion:extensions/v1beta1kind:Deploymentmetadata:name:api-svcspec:replicas:1template:metadata:annotations:revision:"{{CF_REVISION}}"labels:app:api-svcspec:containers:        -name:apisvcimage:myrepo/apisvc:{{CF_BRANCH}}-{{CF_REVISION}}ports:            -containerPort:80name:http

codefresh.yml

---version:'1.0'steps:build:type:builddockerfile:Dockerfileimage_name:myrepo/apisvctag:'${{CF_BRANCH}}-{{CF_REVISION}}'push:type:pushcandidate:${{build}}tag:'${{CF_BRANCH}}-{{CF_REVISION}}'deploy-to-kubernetes:image:codefresh/cf-deploy-kubernetestag:latestworking_directory:${{clone}}commands:      -/cf-deploy-kubernetes deployment.ymlenvironment:      -KUBECONTEXT=my-clusterg@my-staging      -KUBERNETES_NAMESPACE=mynamespace

About

A Codefresh step to deploy to Kubernetes

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors25


[8]ページ先頭

©2009-2025 Movatter.jp