Add health port to network proxy

This commit is contained in:
Jefftree 2020-06-08 16:13:43 -07:00
parent 508794cea6
commit c6b2b1fad3
3 changed files with 13 additions and 7 deletions

View File

@ -23,7 +23,7 @@ spec:
- key: "CriticalAddonsOnly" - key: "CriticalAddonsOnly"
operator: "Exists" operator: "Exists"
containers: containers:
- image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.8 - image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.9
name: konnectivity-agent name: konnectivity-agent
command: ["/proxy-agent"] command: ["/proxy-agent"]
args: [ args: [

View File

@ -1709,7 +1709,8 @@ function start-etcd-servers {
# Replaces the variables in the konnectivity-server manifest file with the real values, and then # Replaces the variables in the konnectivity-server manifest file with the real values, and then
# copy the file to the manifest dir # copy the file to the manifest dir
# $1: value for variable "agent_port" # $1: value for variable "agent_port"
# $2: value for bariable "admin_port" # $2: value for variable "health_port"
# $3: value for variable "admin_port"
function prepare-konnectivity-server-manifest { function prepare-konnectivity-server-manifest {
local -r temp_file="/tmp/konnectivity-server.yaml" local -r temp_file="/tmp/konnectivity-server.yaml"
params=() params=()
@ -1731,7 +1732,8 @@ function prepare-konnectivity-server-manifest {
params+=("--server-port=0") params+=("--server-port=0")
params+=("--agent-port=$1") params+=("--agent-port=$1")
params+=("--admin-port=$2") params+=("--health-port=$2")
params+=("--admin-port=$3")
params+=("--agent-namespace=kube-system") params+=("--agent-namespace=kube-system")
params+=("--agent-service-account=konnectivity-agent") params+=("--agent-service-account=konnectivity-agent")
params+=("--kubeconfig=/etc/srv/kubernetes/konnectivity-server/kubeconfig") params+=("--kubeconfig=/etc/srv/kubernetes/konnectivity-server/kubeconfig")
@ -1742,7 +1744,8 @@ function prepare-konnectivity-server-manifest {
done done
sed -i -e "s@{{ *konnectivity_args *}}@${konnectivity_args}@g" "${temp_file}" sed -i -e "s@{{ *konnectivity_args *}}@${konnectivity_args}@g" "${temp_file}"
sed -i -e "s@{{ *agent_port *}}@$1@g" "${temp_file}" sed -i -e "s@{{ *agent_port *}}@$1@g" "${temp_file}"
sed -i -e "s@{{ *admin_port *}}@$2@g" "${temp_file}" sed -i -e "s@{{ *health_port *}}@$2@g" "${temp_file}"
sed -i -e "s@{{ *admin_port *}}@$3@g" "${temp_file}"
sed -i -e "s@{{ *liveness_probe_initial_delay *}}@30@g" "${temp_file}" sed -i -e "s@{{ *liveness_probe_initial_delay *}}@30@g" "${temp_file}"
mv "${temp_file}" /etc/kubernetes/manifests mv "${temp_file}" /etc/kubernetes/manifests
} }
@ -1753,7 +1756,7 @@ function prepare-konnectivity-server-manifest {
function start-konnectivity-server { function start-konnectivity-server {
echo "Start konnectivity server pods" echo "Start konnectivity server pods"
prepare-log-file /var/log/konnectivity-server.log prepare-log-file /var/log/konnectivity-server.log
prepare-konnectivity-server-manifest "8132" "8133" prepare-konnectivity-server-manifest "8132" "8133" "8134"
} }
# Calculates the following variables based on env variables, which will be used # Calculates the following variables based on env variables, which will be used

View File

@ -12,7 +12,7 @@ spec:
hostNetwork: true hostNetwork: true
containers: containers:
- name: konnectivity-server-container - name: konnectivity-server-container
image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-server:v0.0.8 image: us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-server:v0.0.9
resources: resources:
requests: requests:
cpu: 25m cpu: 25m
@ -21,7 +21,7 @@ spec:
httpGet: httpGet:
scheme: HTTP scheme: HTTP
host: 127.0.0.1 host: 127.0.0.1
port: {{ admin_port }} port: {{ health_port }}
path: /healthz path: /healthz
initialDelaySeconds: {{ liveness_probe_initial_delay }} initialDelaySeconds: {{ liveness_probe_initial_delay }}
timeoutSeconds: 60 timeoutSeconds: 60
@ -29,6 +29,9 @@ spec:
- name: agentport - name: agentport
containerPort: {{ agent_port }} containerPort: {{ agent_port }}
hostPort: {{ agent_port }} hostPort: {{ agent_port }}
- name: healthport
containerPort: {{ health_port }}
hostPort: {{ health_port }}
- name: adminport - name: adminport
containerPort: {{ admin_port }} containerPort: {{ admin_port }}
hostPort: {{ admin_port }} hostPort: {{ admin_port }}