Last active
October 15, 2022 07:17
-
-
Save davidecavestro/bee90919f6ac3c43c2122088d3186393 to your computer and use it in GitHub Desktop.
Reproduce resolveD integration issues for telepresence on Ubuntu 20.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.synced_folder "./", "/vagrant" | |
# config.vm.box = "generic/ubuntu2004" | |
# config.vm.provider :libvirt do |domain| | |
# domain.memory = 4096 | |
# domain.nested = true | |
# end | |
config.vm.box = "ubuntu/focal64" | |
config.vm.provider "virtualbox" do |vb| | |
# Display the VirtualBox GUI when booting the machine | |
vb.gui = false | |
vb.name = "tel2_resolved" | |
# Customize the amount of memory on the VM: | |
vb.memory = "4096" | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
export MICROK8S_VERSION='1.25' | |
export TEL2_VERSION='2.7.6' | |
echo "---> installing microk8s..." | |
snap install microk8s --classic --channel=${MICROK8S_VERSION} | |
microk8s status --wait-ready | |
microk8s enable dns rbac | |
echo "---> installing telepresence..." | |
curl -SsfL https://app.getambassador.io/download/tel2/linux/amd64/${TEL2_VERSION}/telepresence -o /usr/local/bin/telepresence | |
chmod a+x /usr/local/bin/telepresence | |
mkdir -p /root/.config/telepresence | |
cat << 'EOF' > /root/.config/telepresence/config.yml | |
timeouts: | |
agentInstall: 1m | |
intercept: 2m | |
trafficManagerAPI: 100s | |
helm: 2m | |
logLevels: | |
userDaemon: debug | |
rootDaemon: debug | |
EOF | |
echo "---> setting default k8s context..." | |
mkdir -p $HOME/.kube | |
microk8s config > $HOME/.kube/config | |
echo '---> deploying "nginx" service on namespace "tst"...' | |
microk8s kubectl create ns tst | |
cat <<EOF | microk8s kubectl -n tst apply -f - | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: nginx | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx | |
ports: | |
- containerPort: 5701 | |
protocol: TCP | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx | |
spec: | |
ports: | |
- name: http-port | |
port: 80 | |
protocol: TCP | |
selector: | |
app: nginx | |
sessionAffinity: None | |
EOF | |
echo "---> activating telepresence on all namespaces..." | |
telepresence helm install | |
telepresence connect | |
echo "---> getting insights on k8s stuff..." | |
sleep 10s | |
microk8s kubectl -n tst wait --for=condition=ready pod -l app=nginx | |
microk8s kubectl -n tst get po -o yaml | grep "clusterIP:" | |
microk8s kubectl -n tst get svc -o yaml | grep "podIP:" | |
echo "---> Logging telepresence and resolved status..." | |
telepresence status | |
resolvectl status | |
microk8s status | |
echo "---> resolving nginx svc ip address from its namespace-qualified name..." | |
nslookup nginx.tst | |
echo "---> calling nginx svc with namespace-qualified name..." | |
curl -v nginx.tst | |
echo "---> gathering telepresence logs..." | |
telepresence version | |
telepresence gather-logs --output-file /vagrant/telepresence_logs.zip | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment