One place for hosting & domains

      How to Monetize Your Blog: 14 Top Strategies

      We get it! You wanted to connect with other like-minded folks, share a hobby or skill, or promote a small business. There are lots of great reasons to start a blog, and making money might not have been the one that got you into the blogging game.

      But generating a little jingle from your online efforts is definitely worth considering, especially if it helps cover maintenance costs. For instance, using a high-quality web host and a professional theme can make a big difference to the quality of your blog, but they also aren’t free.

      That’s where a monetization strategy comes in handy!

      Fortunately, there are many ways to create reliable streams of revenue through your website. With just a little planning and creativity, your blog can be a source of significant, self-sustaining funds.

      In this article, we’ll offer some detailed guidance about how to monetize your blog. We’ll also share some vital money-making tips and advice about timing your monetization strategy. If you’re ready to make some dough, let’s get started!

      Why Monetization Might Be Right for Your Blog

      In this context, “monetization” simply means turning a regular blog into an income-generating website. If you’re still not sure whether you can make money blogging (or even want to), let’s look a little more at what it entails.

      Naturally, the main reason to monetize a blog is to create a source of passive income. If you’re worried about devoting time to a new endeavor, don’t worry! Most monetization methods won’t require a lot of work to maintain after you set them up.

      If you’re trying to decide whether monetizing a blog is the right for you, here are three of the best reasons to go for it:

      • You want to support the expenses that running your blog incurs.
      • Your readers want more from you, and you’re ready to expand how you engage with them.
      • It’s time to improve your website by adding in some advanced plugins or premium themes and even upgrading your hosting.

      If any of those scenarios fit your current situation, then you’re in the right place! You might be ready to take a big step with your website. First, however, let’s talk about how to time your monetization venture for the best effect.

      Power Your Blog with DreamHost

      We’ll make sure your blog is fast, secure and always up so your visitors trust you. Plans start at $2.59/mo.

      How to Choose the Right Time to Implement a Monetization Strategy

      Timing your foray into the world of blog monetization is a critical element in the process. No, you don’t have to be a full-time blogger to start making money from your blog, but if you take this step too early, you might find that you’re not getting the results you expected.

      With that in mind, let’s look at a couple of scenarios that indicate you’re ready to monetize your blog.

      First and foremost, your audience is a vital element in any monetization strategy. In fact, finding your niche and attracting readers are essential parts of starting any blog. If you’ve found a focused niche for your content and your readership is growing, you’re in a solid place to begin making some revenue.

      Additionally, if your content is really resonating with your target audience, that’s another good indication that your website might be ready for monetizing. There are a couple of ways to find out how your content is performing. Monitoring your traffic, for example, can help you determine whether your readership is growing over time.

      Another key indicator is audience engagement. For instance, if you receive regular comments on your posts, you know that your readers care about your blog and take it seriously.

      Finally, if you have a structured approach to your content management process and a regular, reliable content schedule, you also might be ready to monetize your blog.

      An Introduction to the Most Common Money-Making Options for Bloggers

      Thanks to some innovative open-source tools, there are a wide variety of ways to generate income with a successful blog. While not all options are right for everyone, knowing your audience can help you match the appropriate technique to both your goals and your readers.

      Let’s briefly look at a few common ways to generate money with your blog. For example, affiliate marketing is when you’re compensated for linking out to particular products or websites in your content. Alternatively, you can always generate funds by selling your own products or services.

      If you’re not in the position to do that, you can explore offering ad space for other companies. Of course, there are plenty of alternatives to direct advertising as well, such as taking donations, hosting events, and more.

      Below, we’ll cover each of these strategies in detail.

      How to Monetize Your Blog: 14 Top Strategies

      Now that we’ve covered the basics of monetization, let’s dig in and take a look at some of the best options available to you. Our list has a little bit of everything, so you should be able to find at least one or two techniques you can implement. Plus, we’ll provide some practical advice you can use to get started right away!

      1. Become an Affiliate Marketer

      We mentioned affiliate marketing earlier, but let’s take a look at exactly how you can start making money this way. You’ve likely encountered blogs in the past that mentioned their “content may contain affiliate links.” If you’ve clicked on one of those links and ended up buying something, the blog’s owner got paid for it.

      That’s how affiliate marketing works in a nutshell.

      As you’re writing content, you include links to affiliate products or companies you’ve agreed to partner with and promote. If your readers click on the links and make a purchase, you’ll get paid. The details may vary from program to program, but you generally earn a small commission on each sale resulting from a click-through originating on your site.

      For example, let’s look at our own affiliate program.

      We’ve established a user-friendly affiliate program that clearly details what payouts are available and when you’ll receive them. This brings up another critical thing to note about affiliate marketing. You’ll want to make sure it’s clear what the expectations are not just for payouts, but also what the company expects from you as a marketer.

      It’s pretty easy to get started with affiliate marketing. Just be careful that you don’t end up being required to market something you’re not entirely comfortable with. You want your readers to trust you, so keep that in mind as you explore the many options that are out there.

      You can also check out one of the many WordPress plugins that help you manage your affiliate programs. ThirstyAffiliates is a popular tool.

      “The ThirstyAffiliates WordPress plugin.”

      This plugin can help you manage all of your affiliate links. You can easily add preformatted links to your content as you type. You’ll save time this way, and you’ll also have access to valuable analytics and reports.

      2. Use Ads to Generate Income

      Another common and easy way to generate money from your blog is by allowing advertisers to bid for space on your website. Just as a business might be willing to pay for the best billboard location on the freeway, they’ll pay for prime spots for banner ads or display ads on the internet too.

      Ad networks take available ad space and offer it at auction to various advertisers. In turn, those advertisers will often set parameters for their campaigns. That might include specific target audiences, style and formatting preferences, and goals for how many impressions the ad should get.

      This means that if you have substantial traffic numbers and some space for text or visual advertisements, you can join an ad network. The most popular option is Google’s AdSense.

      “Google’s AdSense platform.”

      One of the nice things about AdSense is that it tailors ad placements to the layout, structure, and content of your website. This makes the ads highly relevant to your readers, increasing the chance that they’ll be clicked on. Plus, you can get started quickly by simply inserting the AdSense code into your website.

      There are other advertising networks out there too. Some of them have more rigorous approval processes than others. If you’re just starting out, you might want to check out some ad networks that are geared towards new websites. For example, PopAds has fast approval and caters to smaller publishers.

      3. Grow Revenue with Sponsored Posts and Reviews

      Creating partnerships with brands and companies that fall within your blog niche is another excellent way of making money online. You can offer to place or write content related to their products on your blog in exchange for a fee.

      There are a few things to consider when doing this, however.

      First, you’ll want to make sure you’re adhering to the Federal Trade Commission’s rules regarding disclosure. In a nutshell, if you’re located in the United States, you need to clearly disclose your sponsored content or any product reviews you’re being compensated for.

      However, before that, you’ll need to secure a sponsor. There’s really nothing stopping you from “cold calling” a business you like. You can ask if they’re interested in paying you to feature content on your website about their products or services.

      Alternatively, you can register with sites like PayPerPost.

      “The PayPerPost website.”

      Essentially, PayPerPost is a directory where bloggers can register, and sponsors can find potential blogs to be featured on. Sponsors can search the directory by topic to narrow down the field of options.

      To get started, you just need to complete a fairly simple form. After that, your information will be searchable in the PayPerPost directory. This is a nice option because you could potentially pair it with another strategy. You can also decide how aggressive you want to be in terms of seeking out sponsored post opportunities.

      4. Partner with Brands as an Influencer

      Establishing yourself as an influencer is another way to create reliable revenue streams. This involves using your social media status to barter with brands. If you have built up enough of a following in certain spaces, you might already be considered a micro-influencer.

      Whether you approach a brand you’d love to showcase on your blog or the brands come to you, these relationships can be financially beneficial. Just as with featuring sponsored reviews, there are some websites out there that can help you establish your influencer presence. Cooperatize is one of them.

      “The Cooperatize micro-influencer platform.”

      If you’re not sure how to go about becoming an influencer, there are a lot of resources out there that can assist you. The basics involve fine-tuning your social media profiles and content. You’ll also need to build up your networks and closely engage with followers.

      After all, it’s hard to “influence” if you don’t have an audience for your posts and content. If you can establish a relationship with a brand that fits your blog’s niche, there can be plenty of benefits for both parties.

      5. Sell Physical Products

      Thanks to the entrepreneurial spirit, social media, and Content Management Systems (CMSs) like WordPress, the online market for goods you can sell yourself is quite vast. The possibilities are just about endless, especially when you take into account the success of websites like Etsy.

      “The Etsy website.”

      In case you’re not familiar with it, Etsy was one of the first websites to offer an online marketplace for handmade goods. It’s the go-to shop for unique and customized items. However, if custom products are not your thing, there are other options.

      Apps that connect you directly to manufacturers have opened up new reseller opportunities. Resellers source desirable or trending products directly and sell them online for a profit. With this strategy, you don’t have to worry about developing, storing, and shipping your own products.

      Of course, you can also design your own online storefront! If you’re using WordPress to create your blog, you also have access to one of the most popular e-commerce plugins out there. WooCommerce makes it extremely easy to set up an online store, and it’s free to use. You can also add many premium features to handle marketing and customer engagement.

      Once you’ve decided what kind of products you’ll sell, you’ll need to get your website set up and choose what type of payment gateways you want to offer customers.

      To launch your online store, it’ll be critical to have an email marketing strategy in place. We’d recommend focusing on building an email list so you can easily let your loyal fans know about your latest offerings. A great way to do this? Create your own email newsletter.

      6. Sell Digital Products or E-books

      If you have expertise in a specific area and have written stellar blog posts on that topic, you might consider marketing some related digital products. For example, you could create an e-book based on either your most popular blog posts or made up of entirely new material.

      If there’s a topic that readers continuously comment on or ask about, that might be an excellent place to start. If an e-book seems too ambitious, you can also think about serializing content and pricing certain portions of it as premium products.

      Whether you decide to offer e-books, music, or another type of digital item, you might want to check out the Easy Digital Downloads plugin for WordPress.

      “The Easy Digital Downloads plugin.”

      Adding a tool like this to your website setup can help you offer user-friendly checkout options. Additionally, the free version of the plugin comes with both the PayPal and Amazon payment gateways.

      Something to keep in mind is that this monetization strategy doesn’t have to be your only source of income. Offering a digital download or two on your blog pairs well with many other options on our list. For example, you could easily incorporate ads or affiliate marketing as well, in order to boost revenue.

      7. Offer Coaching or Consultations

      Similar to turning your expertise into e-books or another downloadable product, you can also offer coaching services or consultations for a premium fee. If you enjoy engaging with people one-on-one, whether virtually or in person, this can be a satisfying way to monetize a blog.

      Fortunately, WordPress can help you manage a busy consultation schedule. For example, the Booking Calendar plugin is a highly-rated and well-maintained solution.

      “The WordPress Booking Calendar plugin.”

      By combining this plugin with a popular payment gateway like PayPal, you can be up and running with a money-making coaching or consulting business in no time.

      There are a few things to keep in mind if you’re interested in this approach.

      This is a monetization strategy that requires a bit more work on your end, both upfront and on an ongoing basis. If you’re looking for a way to ease into your own full-time business, however, this is definitely an on-ramp worth exploring.

      Something else to consider when developing your strategy is how you’ll promote interest in your new services. One of your best options is to put together one or more dedicated landing pages, which can provide all the details needed to turn readers into clients.

      Be Awesome on the Internet

      Join our monthly newsletter for tips and tricks to build your dream website!

      8. Run an Online Course

      There’s no doubt that the option to take courses online has become a popular and accepted form of education. Professionals can add to their knowledge base in this way, and students can even complete degrees.

      As a blogger with something to teach, running your own online course is another top monetization possibility. One way to determine what topics might be popular is to look at LinkedIn Learning and research what’s trending.

      “LinkedIn Learning course options.”

      Once you determine which subjects might be appealing to your readers, you can experiment with WordPress’ Learn Dash plugin. This is a tool that can help you turn your WordPress website into a full Learning Management System (LMS).

      LearnDash includes just about all of the features you’ll need to create an online course. This includes pricing functionality, points, and certificate options for students. You’ll be able to create an engaging learning opportunity for your readers, earn some money, and establish yourself or your business as a knowledgeable authority.

      9. Host a Virtual Summit

      If you’re not sold on some of the other options on our list, but you want to find a way to generate revenue while engaging with other professionals in your field, don’t worry. Monetization is still very much a possibility for your blog!

      Thanks to a wide array of accessible and affordable communication technologies, you can organize and host virtual summits. These mini-conferences can also be delivered as live or recorded webinars, for both new and old readers to engage with.

      One way to coordinate efforts between your webinar platform and your website is to use a plugin like WP GoToWebinar.

      “The GoToWebinar plugin for WordPress.”

      To use this tool, you’ll need a GoToWebinar account. Then you’ll be able to easily embed a list of upcoming webinars on your site, as well as connect to registration forms. Keep in mind that if you have a global reach, however, you’ll want to make sure your offerings follow the General Data Protection Regulation (GDPR) rules.

      If you need to have a lot of control over your schedule and can leverage specific times of the year when you require an income boost, this is a great option. With a virtual summit, you can pull in your favorite professional resources and create an engaging online event for your followers.

      10. Start a Podcast

      Podcasts hit the big time in 2019. Crossing over into the mainstream, statistics soon showed that just over half of the U.S. population had listened to a podcast. While it might seem like “everyone” has a podcast, however, that doesn’t mean there isn’t room in the market for yours.

      A podcast can be an excellent companion to an existing blog. Once you find the right niche, you can scope out some top podcast charts to see where you might fit in. After that, getting your podcast website ready for monetizing is your next step. Once you’re set up and have established a following, you can experiment with some of the other solutions on our list.

      For example, ad spending on podcasts is a growing area that can have better results than traditional advertising options. However, if you’re not interested in placing ads on your site or mentioning sponsors during each episode, there are other monetization options.

      For instance, you can create a podcast membership site with the Ultimate Member plugin.

      “The Ultimate Member plugin.”

      This is a popular, well-maintained, and highly-rated tool. One caveat is that you’ll need to upgrade to the premium version if you want to integrate it with WooCommerce for paid podcast memberships. Alternatively, there are some plugins like Paid Member Subscriptions that offer a few more features for free.

      11. Create a YouTube Channel

      Similar to podcasting, creating an engaging YouTube channel can be a lucrative (and fun!) endeavor to complement your blog. However, it might seem overwhelming at first to keep up with all the best practices for monetizing videos online.

      One way to make things simpler is to do some research into the YouTube Partner Program. While it’s possible to use your YouTube channel to boost your on-site revenue, the platform offers specific and beginner-friendly tools through its dedicated program as well.

      “The YouTube Monetization tool requirements.”

      If you’re not able to apply for the program, you can still use YouTube to drive traffic to your blog. When you combine elements like AdSense, affiliate marketing, and more, you can create a dynamic money-making system. You can even link to your own landing pages from your YouTube videos.

      12. Accept Donations

      If you don’t need income to keep your website afloat, but would like to make money blogging to pay for future upgrades, accepting donations is an option you might explore. Loyal readers will likely support your passions if you have plans that will bring them more of the log posts they love.

      For example, if your niche is travel and photography, you could accept donations that are earmarked to go towards your next expedition.

      While you can use one of the many online crowdfunding options, there are also some useful plugins available, such as GiveWP.

      “The Give plugin for WordPress.”

      This tool has a lot of features to offer for passion projects, non-profits, and blogs. The free version includes such a robust feature set that most users won’t need the premium add-ons.

      Alternatively, you can structure a donation system with a well-styled form and a payment gateway such as PayPal. WPForms is a great place to start if you need a form-building plugin. Just keep in mind that you’ll want to be as transparent as possible with how you’re using the donations, so readers will feel confident in giving.

      13. Offer a Paid Membership Plan

      We mentioned some membership plugins earlier when talking about how to monetize a podcast. However, there are other ways to offer and manage a membership plan for your blog itself. One of the most popular platforms for this is Patreon.

      “The Patreon membership platform.”

      One of the best aspects of Patreon is that you can get started for free. The cost of the platform is based on the level of service you choose. Each level takes a cut of your monthly donations. For example, the “Lite” level charges 5% of your monthly donation income.

      Patreon makes it pretty easy to set up content-specific membership sites. You can offer premiums for different levels of donations. This means you can give specific donors access to exclusive content on your blog, or annual premiums.

      14. Develop a Branded Swag Shop

      When you really love a band, writer, movie, etc., it’s common to want to show your support by sporting its branded gear. If you have the resources, creating your own branded swag shop can also be a fun way of making money.

      WooCommerce is, of course, the most popular e-commerce tool out there. It’s an easy addition to any website. However, you can also look into print and ship services, if you’re not prepared to handle the logistics of fulfilling orders.

      The good news is that you can turn your WooCommerce shop into a fulfillment center as well. The Printful integration for WooCommerce is a great place to start.

      “The Printful integration for WooCommerce.”

      With this add-on, you can create a shop by choosing from Printful’s inventory of over 220 items. You can provide designs that are specific to your blog, or choose from the pre-built templates. Additionally, you can set up items that can be individualized by your readers.

      After a purchase is made, Printful will make it and ship it for you! It’s that easy. You can even estimate profits with an online calculator. This will help you set your prices to ensure the level of revenue you need.

      You CAN Make Money Blogging

      Once you decide you want to monetize a blog, you may be tempted to dive in headfirst and try everything you can think of. However, taking a measured approach often leads to a more profitable blog in the long run. We’ve outlined many feasible options for monetizing your blog, but it’s important to keep some specific points in mind when choosing your strategy.

      For example, remember that not all forms of monetization work for all blogs. It’s key to determine whether you’ve found the right blogging niche first. Next, focusing on one or two complementary possibilities are likely to yield the best results. For instance, you might pair AdSense with a podcast or video channel.

      Finally, no matter what approach you take to generating income on your blog, you’ll want to make sure you have the hosting resources you need. We recommend checking out our shared hosting plans as a great place to start!

      Source link

      Survey: The Top Challenges Facing IT Departments in 2020

      There will be no shortage of strategic challenges confronting IT leaders and infrastructure managers in 2020, but one issue rises above the pack: Migrating applications to the cloud. That’s according to new survey data published this week by INAP at Gartner’s IT Infrastructure, Operations and Cloud Strategies Conference in Las Vegas.

      This is the second year INAP asked 500 IT professionals with cloud, server or data center management responsibilities to select their top three challenges from a list of perennial issues.

      The results showcase a reshuffling of the leading challenges, with cloud migrations supplanting 2019’s No. 1 answer—“protecting the organization from cyberattacks”—for the top spot in 2020. Take a look at the full list here and read on for analysis and commentary from INAP experts.

      Top Challenges
      Click to view full-size image.

      “Migrating applications to the cloud” sits six points above the rest of the list, and “adopting and/or managing a multicloud strategy” will be a top challenge for 28 percent, tying for third. A simple look at market trends may explain why, according to Jennifer Curry, senior vice president of Global Cloud Services at INAP.

      Overcoming Cloud Adoption Challenges

      “We shouldn’t be surprised by the survey given the current forecasts around growth in the public cloud services market and infrastructure as a service spending,” said Curry, pointing to 12.6 percent CAGR and 27.5 percent CAGR in those respective areas between 2018-2022. “Cloud and IaaS are becoming easier to consume with container-based solutions and more applications that are born in the cloud or are cloud-ready. This also makes it easier to put your workloads in the environment where they work best – businesses don’t have to subscribe to an all-in or all-out strategy.”

      But that doesn’t mean making the journey to the cloud is without its hurdles.

      “Cost overruns are the biggest consequences of migrations gone awry,” said Curry. “Delays caused by application performance issues, downtime caused by botched migrations, unexpected security and compliance issues—all of these issues cost money.”

      Once new cloud environments come online, the work is far from over, as each need to be monitored and optimized on an ongoing basis. The key to overcoming all of these challenges is a mix of people and prep work, according Curry.

      “Ensure you have all the right skills inside of your organization or the right third-party partners to get the most value out of your multicloud strategy,” she said. “It’s also critical to understand where all of your workloads belong and what your true goals are. Is it to move everything off premise in a lift and shift, or is the real goal to optimize and transform with a combination of IaaS, PaaS and SaaS? Being able to define the business value is key to designing the multicloud environment.”

      Cybersecurity Challenges Still Paramount

      Although it dropped five points from last year’s poll, protecting against cyberattacks is the only other challenge selected by greater than 30 percent of IT leaders and infrastructure managers.

      “Cyber attacks are no longer just system or nuisance attacks,” said Jeff Atkinson, Chief Information Officer of INAP. “They’ve gotten much more sophisticated and, in some ways, easier for perpetrators to conduct. This has opened up a much larger world of potential threats and targets—putting organizations of all shapes and sizes in the crosshairs. Given that almost all industries are reliant on some form of digital footprint, it has to be a primary concern to the business and by extension, IT.”

      Most IT Pros Agree Budget Shouldn’t Be an Issue in 2020

      Budget or headcount constraints is a challenge for 24 percent of IT pros, dropping slightly from 26 percent last year. Separately, respondents were asked to agree or disagree with the following statement:

      IT Budget

      Despite a strong majority agreeing that IT budgets will be in a good spot for 2020, the confidence waned slightly for non-senior leaders. Of this group, 1 in 4 disagreed with the statement and only 14% strongly feel their budget will be optimal.  

      Biggest Movers: Skills Shortage Concerns Mount; Disaster Recovery Challenges Wane

      The biggest movers in this year’s list of challenges are “skills shortages hindering key initiatives” (+7) and “adopting and/or implementing a disaster recovery or business continuity strategy” (-7).

      While disaster recovery may simply be less of roadblock as more economically viable and cloud-enabled replication solutions gain popularity, skills shortages in specialty areas may be an issue to watch due to the growing scope of the IT function, according to Atkinson.

      “Every company has some need for IT talent and thus are all competing for the same people,” he said. “This challenge is increased if the skills needed are specialized. Because of this, the IT industry will continue to move to outsourced solutions, allowing companies to put more toward attracting and retaining the specialized talent needed.”

      About the Data

      The data reflected in this report was derived from a survey of 508 IT professionals with data center, server and cloud infrastructure responsibilities who work at businesses and enterprises in the United States and Canada with greater than 100 employees. The survey, commissioned by INAP and facilitated by Precision Sample, was conducted in October 2019. The margin of error is ±5 percent at the 90 percent confidence level.

      Ryan Hunt
      • Director of Content & Communications

      Ryan Hunt is the Director of Content & Communications. READ MORE

      Source link

      How To Set Up a Private Docker Registry on Top of DigitalOcean Spaces and Use It with DigitalOcean Kubernetes

      The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program.


      A Docker registry is a storage and content delivery system for named Docker images, which are the industry standard for containerized applications. A private Docker registry allows you to securely share your images within your team or organization with more flexibility and control when compared to public ones. By hosting your private Docker registry directly in your Kubernetes cluster, you can achieve higher speeds, lower latency, and better availability, all while having control over the registry.

      The underlying registry storage is delegated to external drivers. The default storage system is the local filesystem, but you can swap this for a cloud-based storage driver. DigitalOcean Spaces is an S3-compatible object storage designed for developer teams and businesses that want a scalable, simple, and affordable way to store and serve vast amounts of data, and is very suitable for storing Docker images. It has a built-in CDN network, which can greatly reduce latency when frequently accessing images.

      In this tutorial, you’ll deploy your private Docker registry to your DigitalOcean Kubernetes cluster using Helm, backed up by DigitalOcean Spaces for storing data. You’ll create API keys for your designated Space, install the Docker registry to your cluster with custom configuration, configure Kubernetes to properly authenticate with it, and test it by running a sample deployment on the cluster. At the end of this tutorial, you’ll have a secure, private Docker registry installed on your DigitalOcean Kubernetes cluster.


      Before you begin this tutorial, you’ll need:

      • Docker installed on the machine that you’ll access your cluster from. For Ubuntu 18.04 visit How To Install and Use Docker on Ubuntu 18.04. You only need to complete the first step. Otherwise visit Docker’s website for other distributions.

      • A DigitalOcean Kubernetes cluster with your connection configuration configured as the kubectl default. Instructions on how to configure kubectl are shown under the Connect to your Cluster step shown when you create your cluster. To learn how to create a Kubernetes cluster on DigitalOcean, see Kubernetes Quickstart.

      • A DigitalOcean Space with API keys (access and secret). To learn how to create a DigitalOcean Space and API keys, see How To Create a DigitalOcean Space and API Key.

      • The Helm package manager installed on your local machine, and Tiller installed on your cluster. Complete steps 1 and 2 of the How To Install Software on Kubernetes Clusters with the Helm Package Manager. You only need to complete the first two steps.

      • The Nginx Ingress Controller and Cert-Manager installed on the cluster. For a guide on how to do this, see How to Set Up an Nginx Ingress with Cert-Manager on DigitalOcean Kubernetes.

      • A domain name with two DNS A records pointed to the DigitalOcean Load Balancer used by the Ingress. If you are using DigitalOcean to manage your domain’s DNS records, consult How to Manage DNS Records to create A records. In this tutorial, we’ll refer to the A records as and

      Step 1 — Configuring and Installing the Docker Registry

      In this step, you will create a configuration file for the registry deployment and install the Docker registry to your cluster with the given config using the Helm package manager.

      During the course of this tutorial, you will use a configuration file called chart_values.yaml to override some of the default settings for the Docker registry Helm chart. Helm calls its packages, charts; these are sets of files that outline a related selection of Kubernetes resources. You’ll edit the settings to specify DigitalOcean Spaces as the underlying storage system and enable HTTPS access by wiring up Let’s Encrypt TLS certificates.

      As part of the prerequisite, you would have created the echo1 and echo2 services and an echo_ingress ingress for testing purposes; you will not need these in this tutorial, so you can now delete them.

      Start off by deleting the ingress by running the following command:

      • kubectl delete -f echo_ingress.yaml

      Then, delete the two test services:

      • kubectl delete -f echo1.yaml && kubectl delete -f echo2.yaml

      The kubectl delete command accepts the file to delete when passed the -f parameter.

      Create a folder that will serve as your workspace:

      Navigate to it by running:

      Now, using your text editor, create your chart_values.yaml file:

      Add the following lines, ensuring you replace the highlighted lines with your details:


        enabled: true
          - secretName: letsencrypt-prod
      storage: s3
        htpasswd: ""
          accessKey: "your_space_access_key"
          secretKey: "your_space_secret_key"
        region: your_space_region
        secure: true
        bucket: your_space_name

      The first block, ingress, configures the Kubernetes Ingress that will be created as a part of the Helm chart deployment. The Ingress object makes outside HTTP/HTTPS routes point to internal services in the cluster, thus allowing communication from the outside. The overridden values are:

      • enabled: set to true to enable the Ingress.
      • hosts: a list of hosts from which the Ingress will accept traffic.
      • annotations: a list of metadata that provides further direction to other parts of Kubernetes on how to treat the Ingress. You set the Ingress Controller to nginx, the Let's Encrypt cluster issuer to the production variant (letsencrypt-prod), and tell the nginx controller to accept files with a max size of 30 GB, which is a sensible limit for even the largest Docker images.
      • tls: this subcategory configures Let's Encrypt HTTPS. You populate the hosts list that defines from which secure hosts this Ingress will accept HTTPS traffic with our example domain name.

      Then, you set the file system storage to s3 — the other available option would be filesystem. Here s3 indicates using a remote storage system compatible with the industry-standard Amazon S3 API, which DigitalOcean Spaces fulfills.

      In the next block, secrets, you configure keys for accessing your DigitalOcean Space under the s3 subcategory. Finally, in the s3 block, you configure the parameters specifying your Space.

      Save and close your file.

      Now, if you haven't already done so, set up your A records to point to the Load Balancer you created as part of the Nginx Ingress Controller installation in the prerequisite tutorial. To see how to set your DNS on DigitalOcean, see How to Manage DNS Records.

      Next, ensure your Space isn't empty. The Docker registry won't run at all if you don't have any files in your Space. To get around this, upload a file. Navigate to the Spaces tab, find your Space, click the Upload File button, and upload any file you'd like. You could upload the configuration file you just created.

      Empty file uploaded to empty Space

      Before installing anything via Helm, you need to refresh its cache. This will update the latest information about your chart repository. To do this run the following command:

      Now, you'll deploy the Docker registry chart with this custom configuration via Helm by running:

      • helm install stable/docker-registry -f chart_values.yaml --name docker-registry

      You'll see the following output:


      NAME: docker-registry ... NAMESPACE: default STATUS: DEPLOYED RESOURCES: ==> v1/ConfigMap NAME DATA AGE docker-registry-config 1 1s ==> v1/Pod(related) NAME READY STATUS RESTARTS AGE docker-registry-54df68fd64-l26fb 0/1 ContainerCreating 0 1s ==> v1/Secret NAME TYPE DATA AGE docker-registry-secret Opaque 3 1s ==> v1/Service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE docker-registry ClusterIP <none> 5000/TCP 1s ==> v1beta1/Deployment NAME READY UP-TO-DATE AVAILABLE AGE docker-registry 0/1 1 0 1s ==> v1beta1/Ingress NAME HOSTS ADDRESS PORTS AGE docker-registry 80, 443 1s NOTES: 1. Get the application URL by running these commands:

      Helm lists all the resources it created as a result of the Docker registry chart deployment. The registry is now accessible from the domain name you specified earlier.

      You've configured and deployed a Docker registry on your Kubernetes cluster. Next, you will test the availability of the newly deployed Docker registry.

      Step 2 — Testing Pushing and Pulling

      In this step, you'll test your newly deployed Docker registry by pushing and pulling images to and from it. Currently, the registry is empty. To have something to push, you need to have an image available on the machine you're working from. Let's use the mysql Docker image.

      Start off by pulling mysql from the Docker Hub:

      Your output will look like this:


      Using default tag: latest latest: Pulling from library/mysql 27833a3ba0a5: Pull complete ... e906385f419d: Pull complete Digest: sha256:a7cf659a764732a27963429a87eccc8457e6d4af0ee9d5140a3b56e74986eed7 Status: Downloaded newer image for mysql:latest

      You now have the image available locally. To inform Docker where to push it, you'll need to tag it with the host name, like so:

      • sudo docker tag mysql

      Then, push the image to the new registry:

      • sudo docker push

      This command will run successfully and indicate that your new registry is properly configured and accepting traffic — including pushing new images. If you see an error, double check your steps against steps 1 and 2.

      To test pulling from the registry cleanly, first delete the local mysql images with the following command:

      • sudo docker rmi && sudo docker rmi mysql

      Then, pull it from the registry:

      • sudo docker pull

      This command will take a few seconds to complete. If it runs successfully, that means your registry is working correctly. If it shows an error, double check what you have entered against the previous commands.

      You can list Docker images available locally by running the following command:

      You'll see output listing the images available on your local machine, along with their ID and date of creation.

      Your Docker registry is configured. You've pushed an image to it and verified you can pull it down. Now let's add authentication so only certain people can access the code.

      Step 3 — Adding Account Authentication and Configuring Kubernetes Access

      In this step, you'll set up username and password authentication for the registry using the htpasswd utility.

      The htpasswd utility comes from the Apache webserver, which you can use for creating files that store usernames and passwords for basic authentication of HTTP users. The format of htpasswd files is username:hashed_password (one per line), which is portable enough to allow other programs to use it as well.

      To make htpasswd available on the system, you'll need to install it by running:

      • sudo apt install apache2-utils -y

      If you're running this tutorial from a Mac, you'll need to use the following command to make htpasswd available on your machine:

      • docker run --rm -v ${PWD}:/app -it httpd htpasswd -b -c /app/htpasswd_file sammy password

      Create it by executing the following command:

      Add a username and password combination to htpasswd_file:

      • htpasswd -B htpasswd_file username

      Docker requires the password to be hashed using the bcrypt algorithm, which is why we pass the -B parameter. The bcrypt algorithm is a password hashing function based on Blowfish block cipher, with a work factor parameter, which specifies how expensive the hash function will be.

      Remember to replace username with your desired username. When run, htpasswd will ask you for the accompanying password and add the combination to htpasswd_file. You can repeat this command for as many users as you wish to add.

      Now, show the contents of htpasswd_file by running the following command:

      Select and copy the contents shown.

      To add authentication to your Docker registry, you'll need to edit chart_values.yaml and add the contents of htpasswd_file in the htpasswd variable.

      Open chart_values.yaml for editing:

      Find the line that looks like this:


        htpasswd: ""

      Edit it to match the following, replacing htpasswd_file_contents with the contents you copied from the htpasswd_file:


        htpasswd: |-

      Be careful with the indentation, each line of the file contents must have four spaces before it.

      Once you've added your contents, save and close the file.

      To propagate the changes to your cluster, run the following command:

      • helm upgrade docker-registry stable/docker-registry -f chart_values.yaml

      The output will be similar to that shown when you first deployed your Docker registry:


      Release "docker-registry" has been upgraded. Happy Helming! LAST DEPLOYED: ... NAMESPACE: default STATUS: DEPLOYED RESOURCES: ==> v1/ConfigMap NAME DATA AGE docker-registry-config 1 3m8s ==> v1/Pod(related) NAME READY STATUS RESTARTS AGE docker-registry-6c5bb7ffbf-ltnjv 1/1 Running 0 3m7s ==> v1/Secret NAME TYPE DATA AGE docker-registry-secret Opaque 4 3m8s ==> v1/Service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE docker-registry ClusterIP <none> 5000/TCP 3m8s ==> v1beta1/Deployment NAME READY UP-TO-DATE AVAILABLE AGE docker-registry 1/1 1 1 3m8s ==> v1beta1/Ingress NAME HOSTS ADDRESS PORTS AGE docker-registry 80, 443 3m8s NOTES: 1. Get the application URL by running these commands:

      This command calls Helm and instructs it to upgrade an existing release, in your case docker-registry, with its chart defined in stable/docker-registry in the chart repository, after applying the chart_values.yaml file.

      Now, you'll try pulling an image from the registry again:

      • sudo docker pull

      The output will look like the following:


      Using default tag: latest Error response from daemon: Get no basic auth credentials

      It correctly failed because you provided no credentials. This means that your Docker registry authorizes requests correctly.

      To log in to the registry, run the following command:

      • sudo docker login

      Remember to replace with your domain address. It will prompt you for a username and password. If it shows an error, double check what your htpasswd_file contains. You must define the username and password combination in the htpasswd_file, which you created earlier in this step.

      To test the login, you can try to pull again by running the following command:

      • sudo docker pull

      The output will look similar to the following:


      Using default tag: latest latest: Pulling from mysql Digest: sha256:f2dc118ca6fa4c88cde5889808c486dfe94bccecd01ca626b002a010bb66bcbe Status: Image is up to date for

      You've now configured Docker and can log in securely. To configure Kubernetes to log in to your registry, run the following command:

      • sudo kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/sammy/.docker/config.json

      You will see the following output:


      secret/regcred created

      This command creates a secret in your cluster with the name regcred, takes the contents of the JSON file where Docker stores the credentials, and parses it as dockerconfigjson, which defines a registry credential in Kubernetes.

      You've used htpasswd to create a login config file, configured the registry to authenticate requests, and created a Kubernetes secret containing the login credentials. Next, you will test the integration between your Kubernetes cluster and registry.

      Step 4 — Testing Kubernetes Integration by Running a Sample Deployment

      In this step, you'll run a sample deployment with an image stored in the in-cluster registry to test the connection between your Kubernetes cluster and registry.

      In the last step, you created a secret, called regcred, containing login credentials for your private registry. It may contain login credentials for multiple registries, in which case you'll have to update the Secret accordingly.

      You can specify which secret Kubernetes should use when pulling containers in the pod definition by specifying imagePullSecrets. This step is necessary when the Docker registry requires authentication.

      You'll now deploy a sample Hello World image from your private Docker registry to your cluster. First, in order to push it, you'll pull it to your machine by running the following command:

      • sudo docker pull paulbouwer/hello-kubernetes:1.5

      Then, tag it by running:

      • sudo docker tag paulbouwer/hello-kubernetes:1.5

      Finally, push it to your registry:

      • sudo docker push

      Delete it from your machine as you no longer need it locally:

      • sudo docker rmi

      Now, you'll deploy the sample Hello World application. First, create a new file, hello-world.yaml, using your text editor:

      Next, you'll define a Service and an Ingress to make the app accessible to outside of the cluster. Add the following lines, replacing the highlighted lines with your domains:


      apiVersion: extensions/v1beta1
      kind: Ingress
        name: hello-kubernetes-ingress
        - host:
            - path: /
                serviceName: hello-kubernetes
                servicePort: 80
      apiVersion: v1
      kind: Service
        name: hello-kubernetes
        type: NodePort
        - port: 80
          targetPort: 8080
          app: hello-kubernetes
      apiVersion: apps/v1
      kind: Deployment
        name: hello-kubernetes
        replicas: 3
            app: hello-kubernetes
              app: hello-kubernetes
            - name: hello-kubernetes
              - containerPort: 8080
            - name: regcred

      First, you define the Ingress for the Hello World deployment, which you will route through the Load Balancer that the Nginx Ingress Controller owns. Then, you define a service that can access the pods created in the deployment. In the actual deployment spec, you specify the image as the one located in your registry and set imagePullSecrets to regcred, which you created in the previous step.

      Save and close the file. To deploy this to your cluster, run the following command:

      • kubectl apply -f hello-world.yaml

      You'll see the following output:


      ingress.extensions/hello-kubernetes-ingress created service/hello-kubernetes created deployment.apps/hello-kubernetes created

      You can now navigate to your test domain — the second A record, in this tutorial. You will see the Kubernetes Hello world! page.

      Hello World page

      The Hello World page lists some environment information, like the Linux kernel version and the internal ID of the pod the request was served from. You can also access your Space via the web interface to see the images you've worked with in this tutorial.

      If you want to delete this Hello World deployment after testing, run the following command:

      • kubectl delete -f hello-world.yaml

      You've created a sample Hello World deployment to test if Kubernetes is properly pulling images from your private registry.


      You have now successfully deployed your own private Docker registry on your DigitalOcean Kubernetes cluster, using DigitalOcean Spaces as the storage layer underneath. There is no limit to how many images you can store, Spaces can extend infinitely, while at the same time providing the same security and robustness. In production, though, you should always strive to optimize your Docker images as much as possible, take a look at the How To Optimize Docker Images for Production tutorial.

      Source link