Simplifying the developer experience has been the mainstay of the Cloud Foundry community’s efforts. In keeping up with the needs of software developers and infrastructure operators, Cloud Foundry has also evolved to help take advantage of the power of Kubernetes, while providing a meaningful abstraction over it.
简化开发人员体验一直是Cloud Foundry社区努力的主要内容。 为了满足软件开发人员和基础架构运营商的需求,Cloud Foundry也在发展以帮助利用Kubernetes的功能,同时为其提供有意义的抽象。
This tutorial is meant for users who would like to get the Cloud Foundry experience over a Kubernetes cluster hosted on DigitalOcean.
本教程适用于希望通过DigitalOcean上托管的Kubernetes集群获得Cloud Foundry经验的用户。
You can view the entire installation as a terminal recording here:
您可以在此处查看整个安装作为终端记录:
Prerequisites — Please check if you’ve already installed doctl, kubectl, cf cli, bosh cli, ytt, and kapp.
先决条件—请检查是否已安装doctl,kubectl,cf cli,bosh cli,ytt和kapp。
Prerequisites part-2: A functional DigitalOcean account, with a 2-node Kubernetes cluster. Note — you can install cf-for-k8s with 2 nodes, but to operate any application at scale, you would need a larger cluster.
先决条件第2部分:具有两个节点Kubernetes集群的功能DigitalOcean帐户。 注—您可以安装具有2个节点的cf-for-k8s,但是要大规模运行任何应用程序,您将需要更大的集群。
Create the cluster and wait for it to be ready before beginning the installation process.
创建群集并等待其准备就绪,然后再开始安装过程。
安装 (Installation)
First, set the context for kubectl on your local machine using the following command:
首先,使用以下命令在本地计算机上设置kubectl的上下文:
doctl kubernetes cluster kubeconfig save <cluster-name>
Next, clone the cf-for-k8s repo from GitHub.
接下来,从GitHub克隆cf-for-k8s仓库。
git https://github.com/cloudfoundry/cf-for-k8s.git
Switch into the cf-for-k8s directory.
切换到cf-for-k8s目录。
cd cf-for-k8s
Create a temporary directory used as a swap space for storing some YAML files.
创建一个临时目录,用作存储某些YAML文件的交换空间。
mkdir ~/tempdir
Use the autogen script available in the repo to generate the YAML file for your cf-for-k8s deployment. [1]
使用回购中可用的autogen脚本为cf-for-k8s部署生成YAML文件。 [1]
./hack/generate-values.sh -d <cf-domain> > ~/tempdir/cf-values.yml
Digital Ocean does not include a metrics server by default when creating a Kubernetes cluster. So, please add this line to the YAML file manually to instruct the cluster to add a metrics server when installing cf-for-k8s.
创建Kubernetes集群时,默认情况下,Digital Ocean不包括指标服务器。 因此,请手动将此行添加到YAML文件中,以指示群集在安装cf-for-k8s时添加指标服务器。
echo “add_metrics_server_components: true” >> ~/tempdir/cf-values.yml
You will also need to add credentials to a container registry. I’m using my publish Docker hub credentials If you have a private container registry, you can substitute the values to point to your own -
您还需要将凭据添加到容器注册表。 我正在使用发布的Docker集线器凭据,如果您有私有容器注册表,则可以替换这些值以指向您自己的-
app_registry: hostname: https://index.docker.io/v1/ repository_prefix: “**********” username: “**********” password: “●●●●●●●●●●”
Use the templating tool to generate the final YAML files which will be used for installation.
使用模板工具生成最终的YAML文件,这些文件将用于安装。
ytt -f config -f ~/tempdir/cf-values.yml > ~/tempdir/cf-for-k8s-rendered.yml
Install cf-for-k8s by using the kapp command to deploy the artifacts indicated in the YAML file generated in the previous step
使用kapp命令安装cf-for-k8s,以部署上一步中生成的YAML文件中指示的构件
kapp deploy -a cf -f ~/tempdir/cf-for-k8s-rendered.yml -y
[1] Please note — you don’t have to use the YAML generator. You can create the file by yourself. This is a convenience. Also, FYI — when using the autogen script, you will receive a warning about it being a temporary/demo script.
[1]请注意-您不必使用YAML生成器。 您可以自己创建文件。 这很方便。 另外,仅供参考-使用autogen脚本时,您将收到有关其为临时/演示脚本的警告。
配置DNS (Configuring the DNS)
In this tutorial, we are using hostnames to point to the Kubernetes cluster running Cloud Foundry. A couple of additional steps are required to make this functional.
在本教程中,我们使用主机名指向运行Cloud Foundry的Kubernetes集群。 要使此功能正常运行,还需要执行几个附加步骤。
1. Add the DigitalOcean nameservers to the DNS management console of your domain registrar. This will render them as a custom nameserver entry.
1.将DigitalOcean域名服务器添加到您的域名注册机构的DNS管理控制台中。 这会将它们呈现为自定义名称服务器条目。
2. Add the domain name with three nameservers (NS) entries on Digital Ocean. These entries are found under the “Networking” tab of the DigitalOcean console.
2.在Digital Ocean上添加带有三个名称服务器(NS)条目的域名。 这些条目位于DigitalOcean控制台的“网络”选项卡下。
3. Add an A name entry to the same table which will enable a wildcard subdomain redirection. This will be of the form “*.domain.ext” and should point to the external IP of the load balancer created during installation. [2]
3.在同一表中添加一个名称条目,这将启用通配符子域重定向。 该文件的格式为“ * .domain.ext”,应指向安装期间创建的负载均衡器的外部IP。 [2]
Once you complete this, an A name entry will be added to the DNS records.
完成此操作后,A名称条目将添加到DNS记录中。
4. One default load balancer behavior on DigitalOcean cloud is the assignment of health checks to a random port. This will render the load balancers’ status as “down”. To change this, point the health check to port 80.
4. DigitalOcean云上的一种默认负载平衡器行为是将运行状况检查分配给随机端口。 这将使负载均衡器的状态为“关闭”。 要更改此设置,请将运行状况检查指向端口80。
[2] Note — This step should be done only after the cf-for-k8s installation is completed successfully.
[2]注—仅在cf-for-k8s安装成功完成之后才应执行此步骤。
This completes the whole installation process.
这样就完成了整个安装过程。
You can check if the Cloud Foundry on Kubernetes is functional by running cf commands.
您可以通过运行cf命令来检查Kubernetes上的Cloud Foundry是否正常运行。
cf api --skip-ssl-validation api.padarekha.comcf login
(use the default admin credentials Email: admin; Password: <check cf-values.yml>)
(使用默认管理员凭据电子邮件:admin;密码:<check cf-values.yml>)
For a full set of post-install steps (login, creating spaces, and pushing a test app), please view this terminal recording:
有关安装后的完整步骤(登录,创建空间和推送测试应用程序),请查看以下终端记录:
Thereafter, you should be able to deploy an application just like you would on any Cloud Foundry installation. Installing cf-for-k8s will allow you to experience the power of Kubernetes with the simplicity of Cloud Foundry.
之后,您应该能够像在任何Cloud Foundry安装中一样部署应用程序。 安装cf-for-k8s可以使您轻松体验Cloud Foundry的Kubernetes功能。
Cloud Foundry Summit Europe 2020 is built by and for the Cloud Foundry community. Whether you’re new to Cloud Foundry, you’re a long-time contributor building the platform, or you’re using Cloud Foundry to attain your business goals, Cloud Foundry Summit is the place to collaborate with other developers, operators, CIOs and IT professionals to shape the future of the project, share best practices and innovate together.
Cloud Foundry Summit Europe 2020由Cloud Foundry社区构建并为Cloud Foundry社区构建。 无论您是Cloud Foundry的新手,还是平台的长期贡献者,还是使用Cloud Foundry来实现业务目标,Cloud Foundry Summit都是与其他开发人员,运营商,CIO和IT专业人员可以塑造项目的未来,共享最佳实践并共同创新。
Dates: Oct 21st & 22nd 2020
日期:2020年10月21日至22日
The best way to connect with the Cloud Foundry community is to join our Slack Workspace at https://slack.cloudfoundry.org/. Those in the Slack community help you get quickly connected with other members or someone from the Cloud Foundry Foundation.
与Cloud Foundry社区建立联系的最佳方法是通过https://slack.cloudfoundry.org/加入我们的Slack Workspace。 Slack社区中的人员可以帮助您快速与其他成员或Cloud Foundry Foundation的人员建立联系。