Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit f9d0e57

Browse files
authored
restore etcd listening on eth0 (#1712)
* restore etcd listening on eth0 * removed etcd on localhost only test * hyphen ftw
1 parent 0d53182 commit f9d0e57

File tree

2 files changed

+1
-43
lines changed

2 files changed

+1
-43
lines changed

parts/kubernetesmastercustomdata.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ runcmd:
372372
- /opt/azure/containers/setup-etcd.sh
373373
{{end}}
374374
- apt-mark hold walinuxagent {{GetKubernetesMasterPreprovisionYaml}}
375-
- /bin/echo DAEMON_ARGS=--name "{{WrapAsVerbatim "variables('masterVMNames')[copyIndex(variables('masterOffset'))]"}}" --initial-advertise-peer-urls "{{WrapAsVerbatim "variables('masterEtcdPeerURLs')[copyIndex(variables('masterOffset'))]"}}" --listen-peer-urls "{{WrapAsVerbatim "variables('masterEtcdPeerURLs')[copyIndex(variables('masterOffset'))]"}}" --advertise-client-urls "{{WrapAsVerbatim "variables('masterEtcdClientURLs')[copyIndex(variables('masterOffset'))]"}}" --listen-client-urls "{{WrapAsVerbatim "concat('http://127.0.0.1:', variables('masterEtcdClientPort'))"}}" --initial-cluster-token "k8s-etcd-cluster" --initial-cluster "{{WrapAsVerbatim "variables('masterEtcdClusterStates')[div(variables('masterCount'), 2)]"}} --data-dir "/var/lib/etcddisk"" --initial-cluster-state "new" | tee -a /etc/default/etcd
375+
- /bin/echo DAEMON_ARGS=--name "{{WrapAsVerbatim "variables('masterVMNames')[copyIndex(variables('masterOffset'))]"}}" --initial-advertise-peer-urls "{{WrapAsVerbatim "variables('masterEtcdPeerURLs')[copyIndex(variables('masterOffset'))]"}}" --listen-peer-urls "{{WrapAsVerbatim "variables('masterEtcdPeerURLs')[copyIndex(variables('masterOffset'))]"}}" --advertise-client-urls "{{WrapAsVerbatim "variables('masterEtcdClientURLs')[copyIndex(variables('masterOffset'))]"}}" --listen-client-urls "{{WrapAsVerbatim "concat(variables('masterEtcdClientURLs')[copyIndex(variables('masterOffset'))], ',http://127.0.0.1:', variables('masterEtcdClientPort'))"}}" --initial-cluster-token "k8s-etcd-cluster" --initial-cluster "{{WrapAsVerbatim "variables('masterEtcdClusterStates')[div(variables('masterCount'), 2)]"}} --data-dir "/var/lib/etcddisk"" --initial-cluster-state "new" | tee -a /etc/default/etcd
376376
- sudo /bin/chown -R etcd:etcd /var/lib/etcd/default
377377
- /opt/azure/containers/mountetcd.sh
378378
- sudo /bin/chown -R etcd:etcd /var/lib/etcddisk

test/e2e/kubernetes/kubernetes_test.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"os"
77
"os/exec"
88
"path/filepath"
9-
"regexp"
109
"time"
1110

1211
"github.com/Azure/acs-engine/pkg/api/common"
@@ -16,7 +15,6 @@ import (
1615
"github.com/Azure/acs-engine/test/e2e/kubernetes/node"
1716
"github.com/Azure/acs-engine/test/e2e/kubernetes/pod"
1817
"github.com/Azure/acs-engine/test/e2e/kubernetes/service"
19-
"github.com/Azure/acs-engine/test/e2e/remote"
2018
. "github.com/onsi/ginkgo"
2119
. "github.com/onsi/gomega"
2220
)
@@ -65,46 +63,6 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
6563
}
6664
})
6765

68-
/* The master nodes are hidden behind a load balancer. Therefore, we will create an ssh connection and then continue to reuse that connection for subsequent commands. We will iterate the nodes first to make sure that we ssh onto each host from a given master and then the inner loop will verify that we cannot connect to another master's etcd instance. If we see a "Host key verification failed" error this is an indication that we are trying to ssh onto a host that we are already on. Then we will just execute the etcdctl command locally. */
69-
It("should not expose etcd to the internet", func() {
70-
hostKeyRegex, err := regexp.Compile("Host key verification failed")
71-
Expect(err).NotTo(HaveOccurred())
72-
73-
nodes, err := node.GetByPrefix("k8s-master")
74-
Expect(err).NotTo(HaveOccurred())
75-
Expect(len(nodes)).NotTo(Equal(0))
76-
77-
conn, err := remote.NewConnection(fmt.Sprintf("%s.%s.cloudapp.azure.com", cfg.Name, cfg.Location), "22", eng.ClusterDefinition.Properties.LinuxProfile.AdminUsername, cfg.GetSSHKeyPath())
78-
Expect(err).NotTo(HaveOccurred())
79-
80-
hostname, err := conn.Execute("hostname")
81-
Expect(err).NotTo(HaveOccurred())
82-
for _, n := range nodes {
83-
for _, nprime := range nodes {
84-
// I am doing this to validate that we always run these commands from the same host
85-
host, err := conn.Execute("hostname")
86-
Expect(err).NotTo(HaveOccurred())
87-
Expect(hostname).To(Equal(host))
88-
89-
if n.Metadata.Name != nprime.Metadata.Name {
90-
etcdCmd := fmt.Sprintf("etcdctl --endpoint=http://%s:2379 ls /registry/secrets/kube-system", nprime.Status.GetAddressByType("InternalIP").Address)
91-
cmd := fmt.Sprintf("ssh %s@%s %s", eng.ClusterDefinition.Properties.LinuxProfile.AdminUsername, n.Metadata.Name, etcdCmd)
92-
93-
out, err := conn.Execute(cmd)
94-
matched := hostKeyRegex.MatchString(string(out))
95-
if !matched {
96-
Expect(err).To(HaveOccurred())
97-
Expect(out).To(MatchRegexp("connection refused"))
98-
} else {
99-
out, err := conn.Execute(etcdCmd)
100-
Expect(err).To(HaveOccurred())
101-
Expect(out).To(MatchRegexp("connection refused"))
102-
}
103-
}
104-
}
105-
}
106-
})
107-
10866
It("should have kube-dns running", func() {
10967
running, err := pod.WaitOnReady("kube-dns", "kube-system", 5*time.Second, cfg.Timeout)
11068
Expect(err).NotTo(HaveOccurred())

0 commit comments

Comments
 (0)