One place for hosting & domains

      April 2021

      What Is a VPS? A Beginner’s Guide to Virtual Private Servers


      If you are finally ready to get your website up and running, it’s probably safe to say you’re looking into purchasing web hosting. And it’s a battlefield out here for beginners. There’s a glossary of new terms — what is a kernel?! — and acronyms seemingly dropping from the sky. One that you’ll hear a lot: VPS hosting.

      But fret not, beginner. This guide will answer all your burning Virtual Private Server questions:

      Ready to learn everything there is to know about a VPS hosting environment? Let’s dive in!

      What Is a Virtual Private Server?

      First, let’s define what VPS actually stands for — virtual private server.

      In layman’s terms, a server is a powerful computer that stores all of the data and files that make up your website. When someone types your domain name into their web browser, that powerful computer “serves up” your website to the searcher’s screen.

      Now for the virtual aspect: VPS uses virtualization technology to split that one powerful server we just talked about into multiple virtual servers. Think of it this way: it’s one piece of physical hardware that functions like several separate servers.

      The word private means just what it implies. Your virtual server is reserved for you, so you won’t have to share RAM, CPU, or any data with other users.

      How Does VPS Work?

      VPS Hosting simulates the experience of a dedicated server even though you’re still sharing the physical server with other users.

      Your web hosting provider installs a virtual layer on top of the operating system (OS) of the server using virtualization technology. Separating the server into individual compartments with virtual walls, this layer allows each user to install their own OS and software.

      Because a VPS separates your files from other users on the OS level, it truly is a private server. This means your website lives within a secure container with guaranteed server resources — think memory, disk space, CPU cores, etc. You don’t have to share any of it with others.

      How VPS Compares with Shared Hosting & Dedicated Hosting

      To truly understand how VPS works, it’s important to get familiar with some of the basics of web hosting, including other common plans. Here’s a brief breakdown of the differences between shared, dedicated, and VPS hosting.

      1. Shared Hosting

      Shared hosting is the most common form of web hosting and works well for many new website owners. When you purchase a shared hosting plan, you’re sharing key resources like CPU, RAM, and hard drive space with other website owners using that same server.

      Let’s use an analogy to make understanding this concept a little easier.

      Think of a shared server as a large apartment complex, and all of the individual apartments are rented by other website owners. All of you need a place to live — just like your website’s files — but going out to buy a huge family home would be too expensive for your needs. Sharing common areas and utilities in an apartment block helps keep costs down. And the same is true for shared hosting.

      There are a few downsides to shared hosting, though, mostly because you’re sharing. For instance, if someone else on your shared server has a huge spike in traffic, that could affect your website’s performance. However, if you’re just getting your website off the ground and don’t have huge traffic volume, shared hosting is a great way to get online!

      Looking for an entry-level plan? Check out our affordable shared hosting packages.

      2. Dedicated Hosting

      Dedicated hosting is the opposite of shared hosting. Rather than pooling resources (and sharing the costs) with other website owners, you have one dedicated server that is reserved for your website only.

      Sounds great, right? The catch is that it’s more expensive, but you get 100% control over your resources and can customize the software to meet your individual needs. This type of hosting package is best for websites with robust technical demands. For example, dedicated hosting could be right for you if:

      • you are getting large amounts of traffic each day.
      • you need to install your own operating system.
      • you are handling thousands of financial transactions.
      • your website requires custom software.

      Need a powerful solution? Check out our dedicated hosting plans.

      3. VPS Hosting

      VPS hosting sits squarely between shared and dedicated. When you choose VPS, there will be other websites hosted on the same hardware as yours (remember that powerful server we talked about earlier?).

      But — and it’s a big one — your website is the only domain allocated to your particular virtual compartment. And that means you get your own operating system, dedicated storage, powerful CPU, scalable RAM, and unlimited bandwidth.

      With a VPS, you are getting many of the benefits of a dedicated server — for an affordable price. In short, VPS hosting can give you more bang for your buck.

      We Know You’ve Got Lots of VPS Options

      At DreamHost, we’ve never been comfortable fitting in with the crowd. Here are a few ways our VPS offering stands apart: 24/7 customer support, an intuitive panel, scalable RAM, unlimited bandwidth, and SSD storage. Plans start at $10/mo.

      When Should You Switch to VPS?

      The best way to evaluate whether or not you need to upgrade to VPS is to take stock of your website. Here are eight tell-tale signs it’s time to go virtual.

      1. You’re Worried About Security

      If you need enhanced security features, advanced monitoring capabilities, more backup space, improved website reliability, or plan on taking any form of online payment, then you may want to consider VPS. With VPS, you get reliable resources and can count on top-notch security features.

      2. You Start to Experience High Traffic Volumes

      If you are just starting your website and don’t receive very much traffic, then shared hosting is the ideal solution. However, if your website’s audience is consistently growing, you’ll want to consider upgrading. You don’t want to run the risk of your website running slowly or, even worse, your server crashing because it can’t handle the traffic. If you anticipate an increase in visitors, do yourself a favor and switch to VPS.

      3. Your Website is Consistently Running Slowly

      Shared hosting is not meant for websites that use large amounts of RAM. As your website grows and you add more and more content, you will start to see a decrease in your website’s load times. As soon as this happens, it’s an indication that you are maxing out your limits. Upgrading to a VPS will enable you to scale your website without having to worry about slow load times.

      4. You Have An Online Store

      The moment you plan on running an online store is the moment you should upgrade your hosting plan. Why? Because with VPS, you have a secure and dedicated virtual server where you are more likely to pass a PCI compliance test. The Payment Card Industry Data Security Standard was established by major credit card brands to protect against cardholder data theft.

      If you are accepting credit cards on your website via a payment gateway, you want to do everything you can to ensure the safety of your consumers’ financial information. Since VPS is more secure than shared hosting, it’s the better option for ecommerce websites.

      5. You Need To Install Custom Software

      Shared hosting is great for website owners who build their site with WordPress or other common Content Management Systems. However, if you reach the point where you need to install custom software, use a custom server configuration, or engage in any other advanced programming, then you’ll want a hosting option that affords you more control.

      Similarly, several standard tax, billing, bookkeeping, and other integrative programs require around-the-clock server availability as well as high-speed internet. To run these applications successfully, you’ll need either a VPS or dedicated hosting account.

      If you operate on a shared server, you’ll only run into frustration when you learn advanced actions are forbidden or that apps don’t have the support needed to function properly. Instead of dealing with this potential problem, upgrade to VPS hosting and immediately gain more control over your programming actions.

      6. You Run Into Server Errors

      Do you encounter “Service Unavailable” errors, any 50X errors, or the “Internal Server Error” often? When you see errors, it’s likely that your potential customers are too. While you can troubleshoot downtime issues, there is simply no room for server errors if you’re running an online business. Pre-empt this problem by upgrading to VPS.

      7. You’re on a Budget

      While it’s true that a dedicated hosting package can address many of the problems on this list, it’s important to remember that a dedicated plan is a much pricier option. If you need to improve your bandwidth, increase your security, and get more RAM, then the most affordable option is to opt for VPS hosting.

      8. You Build Websites For Your Clients

      Is it part of your job to build websites for your clients? With a VPS, you can host an unlimited number of domains all while making sure you have enough RAM for each site to function properly.

      What Is VPS?

      Good question! We regularly report on all things web hosting and tech. Subscribe to our monthly newsletter so you never miss an article.

      How to Choose the Best VPS Hosting Plan for Your Website?

      Now that you know what a VPS is and when you should upgrade, let’s talk about what makes a great VPS plan and how to find the best web hosting provider. After all, you wouldn’t trust your website with just anybody, right?

      Self-Managed Versus Managed VPS Services

      When selecting VPS hosting, you usually have two plan options:

      1. Self-managed VPS service (sometimes called unmanaged VPS)
      2. Managed VPS service

      You need to be familiar with server administration, troubleshooting, and managing the applications, software, and services installed on your VPS if you choose a self-managed service.

      If you are either unfamiliar with these admin skills or you just want your hosting company to take care of it for you, then opting for a managed VPS plan is the way to go.

      All of DreamHost’s VPS plans are fully managed, meaning you can skip worrying about the nitty-gritty technical details and focus on what really matters: creating great content for your website. If you’re looking for root access, though, consider opting for DeamHost’s cloud hosting.

      Linux/Windows

      You might think this tip might fall into the obvious category, but it’s worth sharing: Make sure the hosting package you select is compatible with your operating system. DreamHost, for instance, doesn’t offer Windows hosting since most of our users prefer to run a Linux VPS.

      Reliability

      The VPS hosting service you select should have uptime ratings of 99.5% and above. Anything lower from your web host is simply unacceptable. For the record, DreamHost boasts one of the industry’s highest uptime scores at 99.98%. Stop it, we’re blushing.

      Hardware

      When purchasing a VPS hosting package, make sure your service provider offers the latest and greatest in hardware, including solid state drives (SSD) — the fastest storage technology. SSD makes running high-speed applications easier thanks, in part, to the lack of moving parts.

      24/7 Customer Support

      When it comes down to it, you simply don’t know when you’ll experience a site meltdown. So make sure you purchase a VPS hosting package from a company that offers 24/7 customer support.

      Backup Service

      Imagine you are revamping your site when something goes wrong and you lose everything because you forgot to backup your site. Shivers. This is an all-too-common occurrence, and it can cost you money, time, and more than a few gray hairs. Make sure when you purchase VPS service, you choose a provider that makes backups easy.

      Ready for Your Own Private Server?

      Made it all the way to the end of this guide? Well, pat yourself on the back because you are a VPS beginner no more!

      What it all boils down to is this: If your website is growing and beginning to attract some well-deserved attention, you’ll want its performance to keep pace. And that means it’s time to increase your site’s resources by upgrading to a VPS server.

      While VPS hosting is more expensive than a shared plan, the benefits of this kind of hosting solution give you a lot of bang for your buck – without having to spring for a much-pricier dedicated hosting plan. Wondering which VPS host to choose? Consider DreamHost! Our VPS plans start at just $10/mo.



      Source link

      How to Transfer Your Domain Registration to DreamHost (4 Steps)


      So you’ve got a website. Or maybe you juggle multiple websites and domain names. Perhaps you’re unsatisfied with your current registrar, or you’ve found you’re managing too many different things in too many different places.

      If so, it might be time to consider transferring your domain registration. And you might want to consider transferring it to DreamHost.

      Wondering How to Move a Domain Name to a New Host?

      We can help! Subscribe to our monthly newsletter and get domain insights directly in your inbox.

      Why You Should Consider Transferring Your Domain to DreamHost

      1. You Want to Manage Everything in One Place 

      A while back, we surveyed some of our customers, and they told us the No. 1 benefit of using DreamHost was that it gave them the ability to manage as much as possible in one place. 

      More specifically, 60% of customers we asked said the main benefit of using DreamHost was the ability to manage several websites and domains from a single location

      So if you are running several websites under several different registrars, moving them all to one place would make life a whole lot easier.

      2. You’re Being Charged Too Much for Renewals 

      Like any service, prices vary, and those costs can increase when it’s time to renew. If you feel you’re being charged too much for domain registration renewals, the obvious solution is to change registrars.

      3. Support is Lacking 

      As with price, the support offered by different service providers varies a lot. If you’re not getting the help you need from your current registrar, it may be worth moving to one that can fill the gap (like DreamHost). 

      4. You’d Like to Move a Domain from One DreamHost Account to Another

      If you run many websites, there’s always a chance you’re going to be taking over a domain owned by someone using DreamHost. Should this happen, we allow you to transfer domain ownership from one person to another quickly and with minimal effort. 

      In this situation, the easiest solution is just to continue using DreamHost (and potentially move your other domains over too).

      Need-to-Knows When Transferring a Domain

      Understanding what is and isn’t possible when transferring domains can save you tons of time further down the line and help ensure a smooth and pain-free domain transfer. 

      With that in mind, here are a few things you need to know before you start the process of transferring a domain registration.

      1. Only Certain TLDs Are Allowed

      At DreamHost, we support certain TLDs for transfer. However, it’s actually only a handful of TLDs that cannot be transferred. These are: .AM, .AT, .BZ, .FM, .JP, .NET.NZ, .ORG.NZ, .NGO, .ONG, .OOO, and .WS. 

      For more information, you can check out DreamHost’s TLD page for a current list of domain extensions with pricing.

      Additionally, there are also some New TLDs and ccTLDs which are considered premium domains — for example, .LIVE, .ME, and others. DreamHost cannot accept transferring premium domains due to the pricing structures that vary from one registrar to another. 

      If you’d like to use a premium domain for your website, you’ll need to register it directly with Enom or another registrar that sells premium domains. Then you can host the site on your DreamHost account like any other domain. 

      2. Beware of the ICANN 60-day Transfer Lock

      Did you know you can’t transfer your domain during the first 60 days of registration? You need to wait until day 61.

      It’s also worth remembering that you cannot transfer a domain if your last transfer took place within the previous 60 days.

      And remember, transferring a registration only moves your domain. If you’d like to transfer your web hosting service to DreamHost, we can help with that too.

      3. Downtime Can Happen If You Don’t Get Your Nameservers Sorted First

      It’s important to know that if you decide to change your nameservers to DreamHost after completing a transfer, you may experience some downtime. Changes to the nameservers cannot be made while the domain is pending transfer. 

      We recommend that you start the transfer at least a month in advance — this will make sure your domain registration does not expire during the transfer. 

      What Should You Do Before You Request a Domain Transfer?

      We recommend completing three super simple steps before you make your transfer request. This is because of ICANN’s Transfer Policy, which means that following a transfer, changes made to the registrant’s name, organization, or email address will be put on a 60-day lock

      1. Unlock the domain registration. This is done with your current registrar.
      2. Obtain the auth code, also known as the EPP. You can get this from your current registrar.
      3. Remove WHOIS privacy. This is done through your current registrar. This allows your new registrar to recognize the new owner.

      Now you’ve completed all the preparation, it’s time to transfer your domain to DreamHost. The whole process is pretty simple, but just to be sure, here’s what you need to do. 

      How to Transfer Your Domain to DreamHost in 4 Steps

      Four steps — it’s that easy! Let’s walk you through the process of transferring your domain to DreamHost.

      1. Request the Transfer-In With Dreamhost

      Start by logging in to your DreamHost account. You can do that here. If you don’t have an account yet, you can create one here

      From there, you are going to need to navigate to the Reg Transfer page. There you will find a button labeled Start Transfer to DreamHost — click that. 

      DreamHost’s list of info for what you need to know before starting a domain transfer.

      Have you done that? Cool. You should now see this:

      Requesting a domain transfer in the DreamHost panel. 

      In this section, all you need to do is add the domain(s) you would like to transfer to DreamHost and click Request Transfer

      2. Enter your Auth Code, WHOIS Info, and Nameservers

      Now you need to fill in details to show you are the owner of that domain(s). If you want your contact details to stay hidden, just tick the I want all my contact information private button.

      This is free, by the way. We don’t like unnecessary charges!

      Checkbox for making WHOIS contact info private

      You should now see a section asking you to enter all your WHOIS information. As you might suspect, you need to make sure all your details are valid and correct and that you have followed the ICANN policy we mentioned earlier.

      The WHOIS section looks like this:

      Empty WHOIS information fields to be filled out.

      See that little checkbox at the top? If you click that, it will use these details to automatically fill in the four contact fields on the domain registration’s internal ownership details. These are:

      • Admin
      • Billing
      • Registrant
      • Technical details

      The following section is the Auth Code field.

      Your current registrar should have provided you with either an Auth Code or EPP code. Make sure you fill in the fields with the code exactly as provided to you.

      Once that’s done, you should see the following:

      Filling out nameserver information with the “Use another host’s nameservers” option clicked.

      Choose either Use DreamHost’s nameservers (this automatically sets DreamHost’s nameservers for you) or Use another host’s nameservers (you should choose this if you’d like to enter outside name servers manually). 

      Make sure you have read the Registration’s Terms, and click Continue

      You now need to pay for the transfer. 

      3. Pay for Your Domain Transfer

      If you have a free domain registration with your current registrar, you won’t be charged by DreamHost. If you don’t have a free domain registration, you will need to pay for it here. 

      To complete this step, you first need to review your order. 

      Reviewing order total for example.com ‘Transfer + 1 year registration’

      If you need to pay for the transfer, you will know because the fee will appear in the Order Summary. 

      Click the Proceed to Payment Entry button. You then need to confirm the payment, so press the Submit Transfer Request button. 

      Notification showing ‘Transfer Initiated’ submitted and next steps. 

      On the next screen, you simply need to enter your payment details and click the confirmation button. You should now see that the transfer has been initiated.

      Notification showing ‘Transfer Initiated’ submitted and next steps.

      Navigate to the Reg Transfer page, and if all is well, you will be able to see confirmation that the transfer is pending. 

      Example of a pending transfer in the DreamHost panel. 

      When the transfer has completed, payment will be taken from your bank account. 

      Let’s move on to the last step. 

      4. Check That the Domain Status and EPP Code Are Verified, and Transfer Request Is Submitted to the Current Registrar

      Once the transfer is completed, the authorization code and EPP are verified with your current registrar. 

      The registrar then has five days to release the domain to DreamHost, and the transfer will complete within the seven days after. 

      You can confirm the status by running a quick WHOIS check. If the transfer fails, you can get more help by contacting our support team

      There you go — four simple steps as promised!

      That said, there are little things that can go wrong. Let’s discuss some of the most common domain transfer problems our team here at DreamHost comes across and how they can be fixed without needing to contact support. 

      Ready to Switch Your Domain Registrar?

      Search DreamHost’s 400+ TLDs to find the perfect URL for your website.

      3 Common Domain Transfer Issues

      While the steps involved in transferring a domain are simple, that doesn’t guarantee everything will run without a hitch. There are several factors involved, and if you have issues, it could be for one of the following reasons. 

      1. Some domains update their auth code internally. For example, the .org registry has many security measures and can often change EPP codes automatically. If you see this happening, you need to contact your current registrar. You’ll then need to reset the auth code and resubmit the domain transfer request. 
      2. Some domains are transfer locked. You can establish whether this is an issue by looking at the WHOIS information and checking for the following: Domain Status: clientTransferProhibited. If you see this, you’ll have to contact your current registrar to have it unlocked. Once that’s done, you then need to resubmit the domain transfer in DreamHost.
      3. Intermittent issues with the DNS. After a transfer, you may see this issue. This is usually down to domains having previously used DNSSEC. Find out how to fix it in this article. 

      Still running into issues? Check our Knowledge Base or contact support.

      Master Your Domain at DreamHost

      It’s not uncommon for website owners to start with one domain registrar and later move to another. Over time many of us realize we rushed the initial registration process, didn’t do due research, and wound up being charged too much for too little.

      If this includes you, moving your domain registration — to DreamHost or any other registrar — is much simpler than you might at first think.

      In short, you simply need to:

      1. Request the Transfer-In with DreamHost (or your chosen registrar)
      2. Enter the auth code, WHOIS, and nameservers 
      3. Pay for your transfer 
      4. Wait for your domain status and EPP code to be verified and for your transfer request to be submitted to your current 

      If you’d like to register a new domain, we can help with that too! DreamHost .COM domains cost $7.99 a year and come with free, private registration, while other domains start from less than $1/year. Find out more here.



      Source link

      How To Use Telepresence on Kubernetes for Rapid Development on MacOS


      The author selected the Tech Education Fund to receive a donation as part of the Write for DOnations program.

      Introduction

      Application developers building microservices on Kubernetes often encounter two major problems that slow them down:

      • Slow feedback loops. Once a code change is made, it must be deployed to Kubernetes to be tested. This requires a container build, push to a container registry, and deployment to Kubernetes. This adds minutes to every code iteration.
      • Insufficient memory and CPU locally. Developers attempt to speed up the feedback loop by running Kubernetes locally with minikube or the equivalent. However, resource-hungry applications quickly exceed the compute and memory available locally.

      Telepresence is a Cloud-Native Computing Foundation project for fast, efficient development on Kubernetes. With Telepresence, you run your service locally, while you run the rest of your application in the cloud. Telepresence creates a bi-directional network connection between your Kubernetes cluster and your local workstation. This way, the service you’re running locally can communicate with services in the cluster, and vice versa. That allows you to use the compute and memory resources of the cluster, but without having to go through a complete deployment cycle for each change.

      In this tutorial, you’ll configure Telepresence on your local machine running MacOS to work with a Kubernetes cluster. You’ll intercept traffic to your cluster and redirect it to your local environment.

      To complete this tutorial, you will need:

      Step 1 — Installing Telepresence

      In this step, you’ll install Telepresence and connect it to your Kubernetes cluster. First, make sure that you have kubectl configured and that you can connect to your Kubernetes cluster from your local workstation. Use the get services command to check your cluster’s status:

      The output will look like this, with your own cluster’s IP address listed:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 116m

      Next you’ll install Telepresence locally. Telepresence comes as a single binary.

      Use curl to download the latest binary for MacOS (around 60 MB):

      • sudo curl -fL https://app.getambassador.io/download/tel2/darwin/amd64/latest/telepresence -o /usr/local/bin/telepresence

      Then use chmod to make the binary executable:

      • sudo chmod a+x /usr/local/bin/telepresence

      Now that you have Telepresence installed locally, you can verify that it worked by connecting to your Kubernetes cluster:

      You’ll see the following output:

      Output

      Launching Telepresence Daemon v2.2.0 (api v3) Connecting to traffic manager... Connected to context default (https://<cluster public URL)

      If Telepresence doesn’t connect, check your kubectl configuration.

      Verify that Telepresence is working properly by connecting to the Kubernetes API server with the status command:

      You will see the following output. Telepresence Proxy: ON indicates that Telepresence has configured a proxy to access services on the cluster.

      Output

      Root Daemon: Running Version : v2.2.0 (api 3) Primary DNS : "" Fallback DNS: "" User Daemon: Running Version : v2.2.0 (api 3) Ambassador Cloud : Logged out Status : Connected Kubernetes server : https://e5488ea3-6455-4fc7-be25-09d1d90bde82.k8s.ondigitalocean.com Kubernetes context: your_kubernetes_context Telepresence proxy: ON (networking to the cluster is enabled) Intercepts : 0 total

      When you use telepresence connect, on the server side, Telepresence creates a namespace called ambassador and runs a traffic manager. On the client side, Telepresence sets up DNS to enable local access to remote servers. That means you do not have to use kubectl port-forward to manually configure access to local services. When you access a remote service the DNS resolves to a specific IP address. For more details, see the Telepresence architecture documentation.

      You can now connect to the remote Kubernetes cluster from your local workstation, as if the Kubernetes cluster were running on your laptop. Next you’ll try out a sample application.

      Step 2 — Adding a Sample Node.js Application

      In this step, you’ll use a simple Node.js application to simulate a complex service running on your Kubernetes cluster. Instead of creating the file locally, you’ll access it from DockerHub and deploy it to your cluster from there. The file is called hello-node, and returns a text string:

      var http = require('http');
      
      var handleRequest = function(request, response) {
        console.log('Received request for URL: ' + request.url);
        response.writeHead(200, {'Content-Type': 'text/plain'});
        response.write('Hello, Node!');
        response.end();
      };
      
      http.createServer(handleRequest).listen(9001);
      console.log('Use curl <hostname>:9001 to access this server...');
      

      Use the kubectl create deployment command to create a deployment called hello node:

      • kubectl create deployment hello-node --image=docommunity/hello-node:1.0

      You will see the following output:

      Output

      deployment.apps/hello-node created

      Use the get pod command to confirm that the deployment has occurred and the app is now running on the cluster:

      The output will show a READY status of 1/1.

      Output

      NAME READY STATUS RESTARTS AGE hello-node-86b49779bf-9zqvn 1/1 Running 0 11s

      Use the expose deployment command to make the application available on port 9001:

      • kubectl expose deployment hello-node --type=LoadBalancer --port=9001

      The output will look like this:

      Output

      service/hello-node exposed

      Use the kubectl get svc command to check that the load balancer is running:

      The output will look like this, with your own IP addresses:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-node LoadBalancer 10.245.75.48 <pending> 9001:30682/TCP 4s kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 6d

      If you are using local Kubernetes without load balancer support, then the external IP value for LoadBalancer will show as <pending> permanently. That is fine for the purposes of this tutorial. If you are using DigitalOcean Kubernetes, you should see the external IP value will display the IP address after a delay.

      Next, verify that the application is running by using curl to access the load balancer:

      If you’re not running a load balancer, you can use curl to access the service directly:

      • curl <servicename>.<namespace>:9001

      The output will look like this:

      Output

      Hello, Node!

      Next, use the telepresence connect command to connect Telepresence to the cluster:

      This allows you to access all remote services as if they were local, so you can access the service by name:

      • curl hello-node.default:9001

      You’ll receive the same response as you did when you accessed the service via its IP:

      Output

      Hello, Node!

      The service is up and running on the cluster, and you can access it remotely. If you make any changes to the hello-node.js app, you’d need to take the following steps:

      • Modify the app.
      • Rebuild the container image.
      • Push it to a container registry.
      • Deploy to Kubernetes.

      That is a lot of steps. You could use tooling (automated pipelines, such as Skaffold) to reduce the manual work. But the steps themselves cannot be bypassed.

      Now you’ll build another version of our hello-node app, and use Telepresence to test it without having to build the container image or push it to registry or even deploy to Kubernetes.

      Step 3 — Running a New Version of the Service Locally

      In this step, you’ll modify the existing hello-node application on your local machine. You’ll then use Telepresence to route traffic to the local version with a Telepresence intercept. The intercept takes traffic intended for your cluster and reroutes it to your local version of the service, so you can continue working in your development environment.

      Create a new file containing a modified version of the sample application:

      Add the following code to the new file:

      hello-node-v2.js

      var http = require('http');
      
      var handleRequest = function(request, response) {
        console.log('Received request for URL: ' + request.url);
        response.writeHead(200, {'Content-Type': 'text/plain'});
        response.write('Hello, Node V2!');
        response.end();
      };
      
      http.createServer(handleRequest).listen(9001);
      

      Save and exit the file.

      Start the service with Node:

      Leave the service running, then open a new terminal window and access the service:

      The output will look like this:

      Output

      Hello, Node V2!

      This service is only running locally, however. If you try to access the remote server, it is currently running version 1 of hello-node. To fix that, you’ll enable an intercept to route all traffic going to the hello-node service in the cluster to the local version of the service.

      Use the intercept command to set up the intercept:

      • telepresence intercept hello-node --port 9001

      The output will look like this:

      Output

      Using deployment hello-node intercepted Intercept name : hello-node State : ACTIVE Destination : 127.0.0.1:9001 Volume Mount Error: sshfs is not installed on your local machine Intercepting : all TCP connections

      Check that the intercept has been set up correctly with the status command:

      The output will look like this:

      Output

      Root Daemon: Running Version : v2.2.0 (api 3) Primary DNS : "" Fallback DNS: "" User Daemon: Running Version : v2.2.0 (api 3) Ambassador Cloud : Logged out Status : Connected Kubernetes server : https://e5488ea3-6455-4fc7-be25-09d1d90bde82.k8s.ondigitalocean.com Kubernetes context: <your_kubernetes_context> Telepresence proxy: ON (networking to the cluster is enabled) Intercepts : 1 total hello-node: user@context

      Now access the remote service with curl as you did previously:

      The output will look like this:

      Output

      Hello, Node V2!

      Now, any messages sent to the service on the cluster are redirected to the local service. This is useful in the development stage, because you can avoid the deployment loop (build, push, deploy) for every individual change to your code.

      Conclusion

      In this tutorial, you’ve installed Telepresence on your local machine, and demonstrated how to make code changes in your local environment without having to deploy to Kubernetes every time you make a change. For more tutorials and information about Telepresence, see the Telepresence documentation.



      Source link