Skip to content

Commit 77b69dd

Browse files
authored
[Updated] Deploy a Static Site on Linode Kubernetes Engine (linode#7052)
* [Updated] Deploy a Static Site on Linode Kubernetes Engine * added alternative toml command
1 parent 60d1690 commit 77b69dd

File tree

3 files changed

+36
-35
lines changed
  • ci/vale
  • docs/guides
    • applications/containers/installing-docker-shortguide
    • kubernetes/how-to-deploy-a-static-site-on-linode-kubernetes-engine

3 files changed

+36
-35
lines changed

ci/vale/dictionary.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,7 @@ MXNet
16041604
myapp
16051605
myblog
16061606
mydestination
1607+
mydockerhubusername
16071608
mydomain
16081609
myhostname
16091610
mynewdomain

docs/guides/applications/containers/installing-docker-shortguide/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ To install Docker CE (Community Edition), follow the instructions within one of
2222

2323
- [Installing and Using Docker on CentOS and Fedora](/docs/guides/installing-and-using-docker-on-centos-and-fedora/)
2424

25-
For complete instructions on even more Linux distributions, reference the [Install Docker Engine](https://docs.docker.com/engine/install/) section of Docker's official documentation.
25+
To see installation instructions for other Linux distributions or operating systems like Mac or Windows, reference Docker's official documentation here: [Install Docker Engine](https://docs.docker.com/engine/install/)

docs/guides/kubernetes/how-to-deploy-a-static-site-on-linode-kubernetes-engine/index.md

+34-34
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ external_resources:
1414
aliases: ['/kubernetes/how-to-deploy-a-static-site-on-linode-kubernetes-engine/','/applications/containers/kubernetes/how-to-deploy-a-static-site-on-linode-kubernetes-engine/','/applications/containers/kubernetes/static-site-linode-kubernetes-engine/']
1515
---
1616

17-
*Linode Kubernetes Engine (LKE)* allows you to easily create, scale, and manage Kubernetes clusters to meet your application's demands, reducing the often complicated cluster set-up process to just a few clicks. Linode manages your Kubernetes master node, and you select how many Linodes you want to add as worker nodes to your cluster.
17+
*Linode Kubernetes Engine (LKE)* allows you to easily create, scale, and manage Kubernetes clusters to meet your application's demands, reducing the often complicated cluster set-up process to just a few clicks. Linode manages your Kubernetes master node, and you select how many Compute Instances you want to add as worker nodes to your cluster.
1818

1919
Deploying a static site using an LKE cluster is a great example to follow when learning Kubernetes. A [container](/docs/guides/kubernetes-reference/#container) image for a static site can be written in less than ten lines, and only one container image is needed. Therefore, it's often less complicated to deploy a static site on Kubernetes than some other applications that require multiple components.
2020

2121
{{< note type="alert" >}}
22-
Following the instructions in this guide creates billable resources on your account in the form of Linodes and NodeBalancers. You are billed an hourly rate for the time that these resources exist on your account. Be sure to follow the [tear-down section](#tear-down-your-lke-cluster-and-nodebalancer) at the end of this guide if you do not wish to continue using these resources.
22+
Following the instructions in this guide creates billable resources on your account in the form of Compute Instances and NodeBalancers. You are billed an hourly rate for the time that these resources exist on your account. Be sure to follow the [tear-down section](#tear-down-your-lke-cluster-and-nodebalancer) at the end of this guide if you do not wish to continue using these resources.
2323
{{< /note >}}
2424

2525
## In this Guide
@@ -42,19 +42,11 @@ This guide shows you how to:
4242
- [Sign up for a Docker Hub Account](#sign-up-for-a-docker-hub-account)
4343
- [Install Hugo](#install-hugo)
4444

45-
- Finally, you need to create a cluster on LKE, if you do not already have one:
45+
- Finally, you need to create an LKE cluster, if you do not already have one:
4646

47-
- To create a cluster in the Linode Cloud Manager, review the [Deploy a Cluster with Linode Kubernetes Engine](/docs/products/compute/kubernetes/) guide.
47+
- To create a cluster from the Cloud Manager, review the [Deploy a Cluster with Linode Kubernetes Engine](/docs/products/compute/kubernetes/) guide. Specifically, follow the [Create an LKE Cluster](/docs/products/compute/kubernetes/guides/create-cluster/) and [Connect to your LKE Cluster with kubectl](/docs/products/compute/kubernetes/guides/kubectl/) sections.
4848

49-
{{< note >}}
50-
Specifically, follow the [Create an LKE Cluster](/docs/products/compute/kubernetes/guides/create-cluster/) and [Connect to your LKE Cluster with kubectl](/docs/products/compute/kubernetes/guides/kubectl/) sections.
51-
{{< /note >}}
52-
53-
- To create a cluster from the Linode API, review the [Deploy and Manage a Cluster with Linode Kubernetes Engine and the Linode API](/docs/products/compute/kubernetes/guides/deploy-and-manage-cluster-with-the-linode-api/) tutorial.
54-
55-
{{< note >}}
56-
Specifically, follow the [Create an LKE Cluster](/docs/products/compute/kubernetes/guides/deploy-and-manage-cluster-with-the-linode-api/#create-an-lke-cluster) section.
57-
{{< /note >}}
49+
- To create a cluster via the Linode API, review the [Deploy and Manage a Cluster with Linode Kubernetes Engine and the Linode API](/docs/products/compute/kubernetes/guides/deploy-and-manage-cluster-with-the-linode-api/) tutorial. Specifically, follow the [Create an LKE Cluster](/docs/products/compute/kubernetes/guides/deploy-and-manage-cluster-with-the-linode-api/#create-an-lke-cluster) section.
5850

5951
### Install kubectl
6052

@@ -76,7 +68,7 @@ You use [Docker Hub](https://hub.docker.com/) to store your Docker image. If you
7668

7769
### Install Hugo
7870

79-
A *static site generator* (SSG) is usually a command line tool that takes text files written in a markup language like [Markdown](https://daringfireball.net/projects/markdown/), applies a stylized template to the content, and produces valid HTML, CSS, and JavaScript files. Static sites are prized for their simplicity and speed, as they do not generally have to interact with a database.
71+
A *static site generator* (SSG) is a command line tool that takes text files written in a markup language like [Markdown](https://daringfireball.net/projects/markdown/), applies a stylized template to the content, and produces valid HTML, CSS, and JavaScript files. Static sites are prized for their simplicity and speed, as they do not generally have to interact with a database.
8072

8173
The Linode documentation website, and this guide, employ [Hugo](https://gohugo.io). Hugo is a powerful and fast SSG written in the [Go](/docs/guides/install-go-on-ubuntu/#what-is-go) programming language, but you can choose one that best suits your needs by reading our [How to Choose a Static Site Generator guide](/docs/guides/how-to-choose-static-site-generator/).
8274

@@ -138,18 +130,30 @@ In this section you creates a static site on your workstation using Hugo.
138130
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
139131
```
140132

141-
{{< note >}}
142133
Git submodules allow you to include one Git repository within another, each maintaining their own version history. To view a collection of Hugo themes, visit the [Hugo theme collection](https://themes.gohugo.io/).
143-
{{< /note >}}
144134

145-
1. In the text editor of your choice, open the `config.toml` file and add the following line to the end:
135+
1. In the text editor of your choice, open the `hugo.toml` file and add the following line to the end:
146136

147137
```file
148138
theme = "ananke"
149139
```
150140

151141
This line instructs Hugo to search for a folder named `ananke` in the `themes` directory and applies the templating it finds to the static site.
152142

143+
{{< note title="Older Hugo versions use config.toml" >}}
144+
If you are using an older version of Hugo, you may see a `config.toml` file instead of `hugo.toml`. Should any errors persist, you can rename the file to the alternative name using one of the commands below:
145+
```command
146+
mv hugo.toml config.toml
147+
```
148+
```command
149+
mv config.toml hugo.toml
150+
```
151+
Alternatively, you can duplicate the file and its contents to a second file using the other name and then link the two. This allows both files to exist without conflict:
152+
```command
153+
ln hugo.toml config.toml
154+
```
155+
{{< /note >}}
156+
153157
1. Add an example first post to your Hugo site:
154158

155159
```command
@@ -167,8 +171,8 @@ In this section you creates a static site on your workstation using Hugo.
167171
```file {title="lke-example/content/posts/first_post.md" lang=md}
168172
---
169173
title: "First_post"
170-
date: 2019-07-29T14:22:04-04:00
171-
draft: false
174+
date: 2024-07-17T14:41:25-04:00
175+
draft: true
172176
---
173177
```
174178

@@ -177,7 +181,7 @@ In this section you creates a static site on your workstation using Hugo.
177181
```file {title="lke-example/content/posts/first_post.md" lang=md}
178182
---
179183
title: "First Post About LKE Clusters"
180-
date: 2019-07-29T14:22:04-04:00
184+
date: 2024-07-17T14:41:25-04:00
181185
draft: false
182186
---
183187
@@ -259,8 +263,8 @@ In this section you create a Docker container for your static site, which you th
259263
1. Add the following contents to the `Dockerfile`. Each command has accompanying comments that describe their function:
260264
261265
```file {title="lke-example/Dockerfile"}
262-
# Install the latest Debian operating system.
263-
FROM alpine:3.12.0 as HUGO
266+
# Install the latest Alpine operating system.
267+
FROM alpine:3.20.1 as HUGO
264268
265269
# Install Hugo.
266270
RUN apk update && apk add hugo
@@ -294,19 +298,15 @@ In this section you create a Docker container for your static site, which you th
294298
.gitignore
295299
```
296300
297-
{{< note >}}
298301
This file, similar to the `.gitignore` file you created in the previous section, allows you to ignore certain files within the working directory that you want to leave out of the container. Because you want the container to be the smallest size possible, the `.dockerignore` file includes the `public/` folder and some hidden folders that Git creates.
299-
{{< /note >}}
300302
301-
1. Run the Docker `build` command. Replace `mydockerhubusername` with your Docker Hub username. The period at the end of the command tells Docker to use the current directory as its build context.
303+
1. Run the Docker `build` command. Replace {{< placeholder "mydockerhubusername" >}} with your Docker Hub username. The period at the end of the command tells Docker to use the current directory as its build context.
302304
303305
```command
304-
docker build -t mydockerhubusername/lke-example:v1 .
306+
docker build -t {{< placeholder "mydockerhubusername" >}}/lke-example:v1 .
305307
```
306308
307-
{{< note >}}
308-
In the example below, the container image is named `lke-example` and has been given a version tag of `v1`. Feel free to change these values.
309-
{{< /note >}}
309+
In the example, the container image is named `lke-example` and has been given a version tag of `v1`. Feel free to change these values.
310310
311311
1. Docker downloads the required Debian and NGINX images, as well as install Hugo into the image. Once complete, you should see output similar to the following:
312312
@@ -455,10 +455,10 @@ In this section, you create a [Deployment](/docs/guides/kubernetes-reference/#de
455455
456456
1. Create a Service manifest file to provide load balancing for the deployment. Load balancing ensures that traffic is balanced efficiently across multiple backend nodes, improving site performance and ensuring that your static site is accessible should a node go down.
457457
458-
Specifically, the Service manifest that is used in this guide triggers the creation of a Linode [NodeBalancer](/docs/products/networking/nodebalancers/get-started/).
458+
Specifically, the Service manifest that is used in this guide triggers the creation of a [NodeBalancer](/docs/products/networking/nodebalancers/get-started/).
459459
460-
{{< note >}}
461-
The NodeBalancer's creation is controlled through the [Linode Cloud Controller Manager (CCM)](/docs/guides/kubernetes-reference/#linode-cloud-controller-manager). The CCM provides a number of settings, called `annotations`, that allow you to control the functionality of the NodeBalancer. To learn more about the CCM, read our [Installing the Linode CCM on an Unmanaged Kubernetes Cluster](/docs/guides/install-the-linode-ccm-on-unmanaged-kubernetes/) guide.
460+
{{< note title="Cloud Controller Manager (CCM)" >}}
461+
The NodeBalancer's creation is controlled through the [Cloud Controller Manager (CCM)](/docs/guides/kubernetes-reference/#linode-cloud-controller-manager). The CCM provides a number of settings, called `annotations`, that allow you to control the functionality of the NodeBalancer. To learn more about the CCM, read our [Installing the Linode CCM on an Unmanaged Kubernetes Cluster](/docs/guides/install-the-linode-ccm-on-unmanaged-kubernetes/) guide.
462462
{{< /note >}}
463463
464464
1. Name the file `static-site-service.yaml`, save it to your `manifests` directory, and enter the contents of this snippet:
@@ -516,7 +516,7 @@ To learn more about networking within LKE, open ports, and configuring firewall
516516
517517
If you'd like to continue using the static site that you created in this guide, you may want to assign a domain to it. Review the [DNS Records: An Introduction](/docs/guides/dns-overview/) and [DNS Manager](/docs/products/networking/dns-manager/) guides for help with setting up DNS. When setting up your DNS record, use the external IP address that you noted at the end of the previous section.
518518
519-
If you would rather not continue using the cluster you just created, review the [tear-down section](#tear-down-your-lke-cluster-and-nodebalancer) to remove the billable Linode resources that were generated.
519+
If you would rather not continue using the cluster you just created, review the [tear-down section](#tear-down-your-lke-cluster-and-nodebalancer) to remove any billable resources that were generated.
520520
521521
## Tear Down your LKE Cluster and NodeBalancer
522522
@@ -532,7 +532,7 @@ If you would rather not continue using the cluster you just created, review the
532532
kubectl delete -f static-site-service.yaml
533533
```
534534
535-
- To remove the LKE Cluster and the associated nodes from your account, navigate to the [Linode Cloud Manager](https://cloud.linode.com):
535+
- To remove the LKE Cluster and the associated nodes from your account, navigate to the [Cloud Manager](https://cloud.linode.com):
536536
537537
1. Click on the **Kubernetes** link in the sidebar. A new page with a table which lists your clusters appears.
538538

0 commit comments

Comments
 (0)