How to Use Packer and Subiquity on WSL2

Background

My main dev environment is windows convenient WSL2, however the WSL2 instance is isolated from the host machines IP, leading to some issues when it comes to accessing ports WSL ports on my LAN. Specifically the issue I ran into was when building packer and automating my Ubuntu 20.04 install. After some research I found that restricting the subiquity port and port forwarding vis netsh successfully allows packers http server to be reached on my host machines LAN.

Code and Commands

First you need to edit your packer file to restrict the http ports to a single port so you can port forward.

I have included a sample .pkc.hcl file below, the static port configuration is achieved on code lines 30 and 31 by defining http_port_max and http_port_min

Next you will port forward the WLS2 port to your windows host machine with the below command in command prompt (as admin)

netsh interface portproxy add v4tov4 listenport=8336 listenaddress=0.0.0.0 connectport=8336 connectaddress=

Related Posts

Terraform Tips & Tricks – Part 1 – Building A Constant Reference

One of the most common problems I see in large organizations when working with terraform is consistency. When we have a large amount of resources being managed…

Everything You Ever Wanted to Know About Istio but Were Afraid to Ask

Istio is a powerful service mesh that integrates natively with Kubernetes, I have been using Istio as my service mesh, ingress, and egress gateways on my personal…

How to Monitor Your Enphase Home Solar System with Telegraf

How to collect metrics from an Enphase Envoy PV system, with telegraf and influxdb.

How to Deploy Anthos on Bare Metal On-Prem

Introduction The main advantage of Anthos on BM over Anthos on VMWare for on-prem deployments is the ability to run Anthos clusters without a hypervisor license. Cluster…

OPA Gatekeeper: Bringing Law and Order to Kubernetes

Introduction Open Policy Agent (OPA) is a policy based control agent that is able to be integrated on various platforms. For the sake of this document we…

How to Setup Anthos on GKE Autopilot with Private Certificate Authority

What You Will Create The guide will set up the following: 2 Private GKE autopilot clusters with master global access ASM with multicluster mesh IstioIngress gateway to…

Leave a ReplyCancel reply

Exit mobile version